-
Notifications
You must be signed in to change notification settings - Fork 1.8k
JS: Support TypeScript 5.9 and support 'import defer' syntax #20374
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
Conversation
513d09a to
ef114c4
Compare
|
The three projects that are failing on DCA are due to a problem with SARIF exports that is not related to this PR |
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.
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
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.
Nice 🚀
| @@ -0,0 +1,3 @@ | |||
| import defer * as deferred from "somewhere"; | |||
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.
Would it make sense to add inline test expectations?
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.