Skip to content

Conversation

@asgerf
Copy link
Contributor

@asgerf asgerf commented Sep 5, 2025

  • Upgrades the bundled TypeScript compiler to version 5.9.
  • Adds support for the new import defer syntax mentioned in the TypeScript 5.9 changelog
  • Adds import defer parsing support in our JavaScript parser, as this is also a stage 3 JS feature.
  • The presence of the defer keyword can be checked in QL with ImportDeclaration.isDeferredImport(). This feature doesn't really affect our analysis so we don't currently use it for anything.

@asgerf asgerf changed the title JS: Bump TypeScript compiler version JS: Bump TypeScript compiler to 5.9 and support 'import defer' syntax Sep 5, 2025
@asgerf asgerf changed the title JS: Bump TypeScript compiler to 5.9 and support 'import defer' syntax JS: Support TypeScript 5.9 and support 'import defer' syntax Sep 5, 2025
@asgerf
Copy link
Contributor Author

asgerf commented Sep 9, 2025

The three projects that are failing on DCA are due to a problem with SARIF exports that is not related to this PR

@asgerf asgerf marked this pull request as ready for review September 9, 2025 06:13
@asgerf asgerf requested a review from a team as a code owner September 9, 2025 06:13
Copilot AI review requested due to automatic review settings September 9, 2025 06:13
Copy link
Contributor

Copilot AI left a 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 defer syntax 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

Copy link
Contributor

@Napalys Napalys left a 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";
Copy link
Contributor

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?

@asgerf asgerf merged commit d575d3c into github:main Sep 9, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants