-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tsconfig: transpile to es6 #6060
Conversation
Transpile from es5 to es6 to accomodate libraries written in es6. Reason is that es6 is backward compatible with es5 but it is not forward compatible. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
It is not enough, we should use electron and browser apps and check that such constructions like |
Why? I just launched the browser and electron application, I was unable to find regressions UI-wise. Just tried on the TypeScript playground again, and ES5 classes seem to be extendable from ES6 code: playground setup |
To be more clear, my claims are:
|
Oops, the |
Why not? All these people are Theia committers, i.e. responsible for helping to maintaining Theia. If someone just wants to contribute they don't need write access, other committers can review and help to land their work. |
@@ -80,7 +80,7 @@ export class JavaClientContribution extends BaseLanguageClientContribution { | |||
protected onReady(languageClient: ILanguageClient): void { | |||
languageClient.onNotification(ActionableNotification.type, this.showActionableMessage.bind(this)); | |||
languageClient.onNotification(StatusNotification.type, this.showStatusMessage.bind(this)); | |||
languageClient.onRequest(ExecuteClientCommand.type, params => this.commandService.executeCommand(params.command, ...params.arguments)); | |||
languageClient.onRequest(ExecuteClientCommand.type, params => this.commandService.executeCommand(params.command, ...params.arguments || [])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to change it? Does it mean a breaking change for all JSON-RPC using varargs? Could we avoid it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching compilation target to ES6 made TypeScript detect that params.arguments
can be undefined meaning that it could not be unwrapped. It wouldn't let me build.
It is breaking if we try to unwrap undefined values in other places.
Let's have a look at it when Monaco upgrade is finished. |
@AlexTugarev Do you remember how to reproduce inversify/InversifyJS#928 in Theia? |
@akosyakov there was at least one case of an injection with bogus constructor arguments as described in the issue. the included code snipped should tell us if it was fixed in the meanwhile. the execution should produce the same output for es5 and es6. I guess 74e5ac7#diff-7bcf3cc870db868677d26d618e924394 is related. |
@AlexTugarev It means that it was only worked around in this repo, but does not guarantee it won't break for any downstream projects which can use such bindings. Another issue that it is going to cause rippling effect by forcing all extensions and products be recompiled to es6. cc @svenefftinge If we do it we have to collect all possible pitfalls and prepare PRs for extensions under theia ide org. Maybe we discuss it first, seems to be like a lot of work for us and extenders. It is not a showstopper for Monaco migration right now and can be postponed. |
@AlexTugarev After trying out your code snippet on inversify/InversifyJS#928, it looks like inversify sets to constructor(
@inject(DepC) c: DepC,
@inject(DepB) @optional() b: DepB = {b: 0},
@inject(DepA) a: DepA,
@inject(DepB) @optional() d: DepD = {d: 0},
@inject(DepA) e: DepE,
@inject(DepB) @optional() f: DepF = {f: 0},
) In this example, |
Ok
@akosyakov Indeed, since es5 extensions will likely break when importing updated es6 core components... Does that mean that we should systematically use babel to ensure everything is transpiled to the oldest ecma spec? You also mentioned that babel was a no-go with the plugin extension, how so? |
@marechal-p that would be a changed behavior then. what I reported back then was that even optionals a not injected properly in subclasses. |
Ah indeed you are right, I only noticed the odd undefined values. After more testing, it is any parameter with a default value that breaks inversify, optional or not. |
Not sure we want to run babel on the whole codebase, it could increase the build time significantly. In Monaco PR i only use babel to down compile several es6 dependencies.
backend does not go through webpack, unfortunately. But in monaco PR it is turned out to be not an issue to use es6 dependencies for the backend, i.e. we don't extend anything from them. |
See another point which we should not overlook: #5902 (comment) |
What it does
Transpile from es5 to es6 to accomodate libraries written in es6.
Reason is that es6 is backward compatible with es5 but it is not forward
compatible.
Closes #5902.
How to test
To be defined?
yarn test
should terminate successfully.Review checklist
Reminder for reviewers