JS: Support TypeScript 5.9 and support 'import defer' syntax#20374
Merged
asgerf merged 7 commits intogithub:mainfrom Sep 9, 2025
Merged
JS: Support TypeScript 5.9 and support 'import defer' syntax#20374asgerf merged 7 commits intogithub:mainfrom
asgerf merged 7 commits intogithub:mainfrom
Conversation
513d09a to
ef114c4
Compare
Contributor
Author
|
The three projects that are failing on DCA are due to a problem with SARIF exports that is not related to this PR |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request upgrades the bundled TypeScript compiler to version 5.9 and adds support for the import defer syntax, which is both a TypeScript 5.9 feature and a Stage 3 JavaScript feature. The implementation includes parser support for the defer keyword in import declarations and provides an API method to check for deferred imports.
Key changes:
- Upgraded TypeScript from 5.8 to 5.9
- Added parsing support for
import defersyntax in both TypeScript and JavaScript - Added
isDeferredImport()predicate to check for deferred import declarations
Reviewed Changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
javascript/ql/lib/semmle/javascript/ES2015Modules.qll |
Added isDeferredImport() predicate to ImportDeclaration class |
javascript/extractor/src/com/semmle/ts/extractor/TypeScriptASTConverter.java |
Modified import parsing to handle defer keyword through ImportPhaseModifier |
javascript/extractor/src/com/semmle/js/ast/ImportPhaseModifier.java |
New enum to represent import phase modifiers (NONE, DEFER, TYPE) |
javascript/extractor/src/com/semmle/js/ast/ImportDeclaration.java |
Updated to use ImportPhaseModifier and added hasDeferKeyword() method |
javascript/extractor/src/com/semmle/jcorn/Parser.java |
Modified JavaScript parser to handle import defer syntax |
javascript/extractor/lib/typescript/package.json |
Upgraded TypeScript dependency from 5.8.2 to 5.9 |
javascript/ql/lib/semmlecode.javascript.dbscheme |
Added has_defer_keyword database relation |
docs/codeql/reusables/supported-versions-compilers.rst |
Updated TypeScript version support from 2.6-5.8 to 2.6-5.9 |
Files not reviewed (1)
- javascript/extractor/lib/typescript/package-lock.json: Language not supported
Napalys
approved these changes
Sep 9, 2025
| @@ -0,0 +1,3 @@ | |||
| import defer * as deferred from "somewhere"; | |||
Contributor
There was a problem hiding this comment.
Would it make sense to add inline test expectations?
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.
import defersyntax mentioned in the TypeScript 5.9 changelogimport deferparsing support in our JavaScript parser, as this is also a stage 3 JS feature.deferkeyword can be checked in QL withImportDeclaration.isDeferredImport(). This feature doesn't really affect our analysis so we don't currently use it for anything.