fix: set Code Editor TypeScript target to ES2020#1738
Merged
willeastcott merged 2 commits intomainfrom Feb 11, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request aims to fix TypeScript type errors in the Code Editor by setting the Monaco TypeScript compiler target to ES2020. However, the PR also includes unrelated changes for signed URL handling in asset loading.
Changes:
- Sets Monaco TypeScript compiler options to target ES2020 with 'es2020' and 'dom' libraries to support modern JavaScript APIs like
Array.prototype.includes()andObject.entries() - Adds signed URL support for asset files and variants (unrelated to PR description)
- Adds
signedUrlstype definition to LaunchConfig (unrelated to PR description)
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/code-editor/monaco/document.ts | Adds target: ES2020 and lib: ['es2020', 'dom'] to Monaco TypeScript compiler options to fix type errors for modern JS APIs |
| src/launch/assets/assets-sync.ts | Adds logic to use pre-signed CloudFront URLs for asset files and variants (unrelated to PR description) |
| modules/editor-api/external/types/config.d.ts | Adds optional signedUrls property to LaunchConfig type (unrelated to PR description) |
Comments suppressed due to low confidence (1)
src/code-editor/monaco/document.ts:183
- The setCompilerOptions call is executed every time a document is loaded (in the 'documents:load' event handler). While the dynamic 'paths' option may need to be recalculated per document due to import map changes, the 'target' and 'lib' settings are static and don't need to be reset on every document load. Consider moving the static compiler options (target, lib, allowJs, checkJs, allowNonTsExtensions, esModuleInterop) to a one-time initialization outside this event handler, and only update the dynamic 'paths' option inside the handler. This would improve performance by avoiding unnecessary reconfiguration of Monaco's TypeScript language service.
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
allowJs: true,
checkJs: true,
allowNonTsExtensions: true,
esModuleInterop: true,
target: monaco.languages.typescript.ScriptTarget.ES2020,
lib: ['es2020', 'dom'],
paths: {
'playcanvas': ['playcanvas.d.ts'],
...monacoImportPaths
}
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e03b54b to
ed7bf0f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
setCompilerOptions replaces Monaco's defaults entirely, so omitting target and lib caused the language service to fall back to ES5/ES6. This made modern APIs like Array.prototype.includes() and Object.entries() show type errors. Explicitly set target to ES2020 and lib to ['es2020', 'dom'] to match the engine's build target. Fixes #1731 Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
9e56e7f to
6ee5edb
Compare
kpal81xd
approved these changes
Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
setCompilerOptionsin the Code Editor's Monaco setup was missingtargetandlib, causing Monaco's TypeScript language service to fall back to ES5/ES6 defaults. This meant modern APIs likeArray.prototype.includes()(ES2016) andObject.entries()(ES2017) showed type errors.targettoScriptTarget.ES2020andlibto['es2020', 'dom']to match the engine's build target.Fixes #1731
Test plan
Array.prototype.includes()in a script -- verify no type errorObject.entries()in a script -- verify no type error