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

JS: upgrade TypeScript to 5.5 #16332

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/codeql/reusables/supported-versions-compilers.rst
Expand Up @@ -25,7 +25,7 @@
Python [9]_,"2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12",Not applicable,``.py``
Ruby [10]_,"up to 3.3",Not applicable,"``.rb``, ``.erb``, ``.gemspec``, ``Gemfile``"
Swift [11]_,"Swift 5.4-5.10","Swift compiler","``.swift``"
TypeScript [12]_,"2.6-5.4",Standard TypeScript compiler,"``.ts``, ``.tsx``, ``.mts``, ``.cts``"
TypeScript [12]_,"2.6-5.5",Standard TypeScript compiler,"``.ts``, ``.tsx``, ``.mts``, ``.cts``"

.. container:: footnote-group

Expand Down
8 changes: 4 additions & 4 deletions javascript/extractor/lib/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion javascript/extractor/lib/typescript/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "typescript-parser-wrapper",
"private": true,
"dependencies": {
"typescript": "5.4.2"
"typescript": "5.5.0-beta"
},
"scripts": {
"build": "tsc --project tsconfig.json",
Expand Down
4 changes: 4 additions & 0 deletions javascript/ql/lib/change-notes/2024-04-26-typescript-5-5.md
@@ -0,0 +1,4 @@
---
category: majorAnalysis
---
* Added support for TypeScript 5.5.
154 changes: 123 additions & 31 deletions javascript/ql/test/library-tests/TypeScript/Types/printAst.expected

Large diffs are not rendered by default.

Expand Up @@ -692,6 +692,27 @@ getExprType
| tst.ts:494:24:494:24 | 0 | 0 |
| tst.ts:494:28:494:33 | "even" | "even" |
| tst.ts:494:36:494:40 | "odd" | "odd" |
| tst.ts:498:8:498:11 | TS55 | typeof TS55 in library-tests/TypeScript/Types/tst.ts |
| tst.ts:499:9:499:15 | strings | string[] |
| tst.ts:499:19:499:32 | (["foo", 123]) | (string \| number)[] |
| tst.ts:499:19:500:11 | (["foo" ... .filter | { <S extends string \| number>(predicate: (value... |
| tst.ts:499:19:500:39 | (["foo" ... tring") | string[] |
| tst.ts:499:20:499:31 | ["foo", 123] | (string \| number)[] |
| tst.ts:499:21:499:25 | "foo" | "foo" |
| tst.ts:499:28:499:30 | 123 | 123 |
| tst.ts:500:6:500:11 | filter | { <S extends string \| number>(predicate: (value... |
| tst.ts:500:13:500:13 | s | string \| number |
| tst.ts:500:13:500:38 | s => ty ... string" | (s: string \| number) => s is string |
| tst.ts:500:18:500:25 | typeof s | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
| tst.ts:500:18:500:38 | typeof ... string" | boolean |
| tst.ts:500:25:500:25 | s | string \| number |
| tst.ts:500:31:500:38 | "string" | "string" |
| tst.ts:502:14:502:16 | str | string |
| tst.ts:502:21:502:27 | strings | string[] |
| tst.ts:503:5:503:7 | str | string |
| tst.ts:503:5:503:19 | str.toLowerCase | () => string |
| tst.ts:503:5:503:21 | str.toLowerCase() | string |
| tst.ts:503:9:503:19 | toLowerCase | () => string |
| tstModuleCJS.cts:1:17:1:28 | tstModuleCJS | () => "a" \| "b" |
| tstModuleCJS.cts:2:12:2:15 | Math | Math |
| tstModuleCJS.cts:2:12:2:22 | Math.random | () => number |
Expand Down
9 changes: 9 additions & 0 deletions javascript/ql/test/library-tests/TypeScript/Types/tst.ts
Expand Up @@ -493,4 +493,13 @@ module TS54 {
const myObj = Object.groupBy([0, 1, 2, 3, 4, 5], (num, index) => {
return num % 2 === 0 ? "even": "odd";
});
}

module TS55 {
const strings = (["foo", 123])
.filter(s => typeof s === "string");

for (const str of strings) {
str.toLowerCase(); // <- string in 5.5, string | number in 5.4
}
}