Skip to content
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

fix: used monaco compiler options latest #913

Merged

Conversation

Kevin101Zhang
Copy link
Contributor

@Kevin101Zhang Kevin101Zhang commented Jul 23, 2024

fix: Set monaco compiler options to latest

@Kevin101Zhang Kevin101Zhang linked an issue Jul 23, 2024 that may be closed by this pull request
@Kevin101Zhang Kevin101Zhang marked this pull request as ready for review July 23, 2024 20:39
@Kevin101Zhang Kevin101Zhang requested a review from a team as a code owner July 23, 2024 20:39
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ES2016,
target: monaco.languages.typescript.ScriptTarget.Latest,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print: monaco.languages.typescript.ScriptTarget

{
"0": "ES3",
"1": "ES5",
"2": "ES2015",
"3": "ES2016",
"4": "ES2017",
"5": "ES2018",
"6": "ES2019",
"7": "ES2020",
"99": "Latest",
"100": "JSON",
"ES3": 0,
"ES5": 1,
"ES2015": 2,
"ES2016": 3,
"ES2017": 4,
"ES2018": 5,
"ES2019": 6,
"ES2020": 7,
"ESNext": 99,
"JSON": 100,
"Latest": 99
}

@Kevin101Zhang
Copy link
Contributor Author

Are there any issues where setting to the latest compiler options can be harmful?

@Kevin101Zhang
Copy link
Contributor Author

Screenshot 2024-07-23 at 4 38 12 PM Screenshot 2024-07-23 at 4 50 08 PM

@darunrs
Copy link
Collaborator

darunrs commented Jul 23, 2024

So the backend runs with a target of es2018 and a runtime of 2021. I'm not totally sure of the difference, even with the comments there. But in any case, that's what we use. I would say maybe we should match them. I'm not clear on what the differences between the versions are, but I would surmise there's at least some, if not significant, differences. Since we use VM2 under the hood, we're kinda forced to be stuck with specific Node/TS/etc. versions. So, perhaps we can stick to either 2018 or 2021.

@Kevin101Zhang
Copy link
Contributor Author

Sorry this got lost in the sprint cycle from last week. I modified the monaco editor to run in 2018 to match the backend.
In this case - all the frontend code is compatible with the same features as the backend target. It should make it easier to share code if necessary.

ES2021 may introduce discrepancies with the backend.

regardless .entries got introduced in 2017 so either work.

@Kevin101Zhang Kevin101Zhang merged commit 3237c18 into main Jul 30, 2024
4 checks passed
@Kevin101Zhang Kevin101Zhang deleted the 865-enable-js-to-a-higher-version-in-monaco-editor branch July 30, 2024 19:44
@darunrs darunrs mentioned this pull request Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enable js to a higher version in monaco editor
2 participants