Skip to content

Commit 53502a8

Browse files
authored
Merge pull request #15510 from yoff/ts-54
JS: Add support for TS 5.4
2 parents 8d504d8 + 6be0ed1 commit 53502a8

File tree

7 files changed

+274
-37
lines changed

7 files changed

+274
-37
lines changed

docs/codeql/reusables/supported-versions-compilers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
Python [9]_,"2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12",Not applicable,``.py``
2626
Ruby [10]_,"up to 3.3",Not applicable,"``.rb``, ``.erb``, ``.gemspec``, ``Gemfile``"
2727
Swift [11]_,"Swift 5.4-5.9.1","Swift compiler","``.swift``"
28-
TypeScript [12]_,"2.6-5.3",Standard TypeScript compiler,"``.ts``, ``.tsx``, ``.mts``, ``.cts``"
28+
TypeScript [12]_,"2.6-5.4",Standard TypeScript compiler,"``.ts``, ``.tsx``, ``.mts``, ``.cts``"
2929

3030
.. container:: footnote-group
3131

javascript/extractor/lib/typescript/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

javascript/extractor/lib/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript-parser-wrapper",
33
"private": true,
44
"dependencies": {
5-
"typescript": "5.3.2"
5+
"typescript": "5.4.2"
66
},
77
"scripts": {
88
"build": "tsc --project tsconfig.json",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: majorAnalysis
3+
---
4+
* Added support for TypeScript 5.4.

javascript/ql/test/library-tests/TypeScript/Types/printAst.expected

Lines changed: 207 additions & 31 deletions
Large diffs are not rendered by default.

javascript/ql/test/library-tests/TypeScript/Types/tests.expected

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,40 @@ getExprType
658658
| tst.ts:483:17:483:58 | ["hello ... string> | [first: string, string] |
659659
| tst.ts:483:18:483:24 | "hello" | "hello" |
660660
| tst.ts:483:27:483:33 | "world" | "world" |
661+
| tst.ts:486:8:486:11 | TS54 | typeof TS54 in library-tests/TypeScript/Types/tst.ts |
662+
| tst.ts:487:48:487:53 | colors | C[] |
663+
| tst.ts:488:12:488:17 | colors | C[] |
664+
| tst.ts:488:12:488:20 | colors[0] | C |
665+
| tst.ts:488:19:488:19 | 0 | 0 |
666+
| tst.ts:491:3:491:57 | createS ... ellow") | "red" \| "green" \| "yellow" |
667+
| tst.ts:491:21:491:46 | ["red", ... green"] | ("red" \| "green" \| "yellow")[] |
668+
| tst.ts:491:22:491:26 | "red" | "red" |
669+
| tst.ts:491:29:491:36 | "yellow" | "yellow" |
670+
| tst.ts:491:39:491:45 | "green" | "green" |
671+
| tst.ts:491:49:491:56 | "yellow" | "yellow" |
672+
| tst.ts:493:9:493:13 | myObj | Partial<Record<"even" \| "odd", number[]>> |
673+
| tst.ts:493:17:493:22 | Object | ObjectConstructor |
674+
| tst.ts:493:17:493:30 | Object.groupBy | <K extends PropertyKey, T>(items: Iterable<T>, ... |
675+
| tst.ts:493:17:495:4 | Object. ... ";\\n }) | Partial<Record<"even" \| "odd", number[]>> |
676+
| tst.ts:493:24:493:30 | groupBy | <K extends PropertyKey, T>(items: Iterable<T>, ... |
677+
| tst.ts:493:32:493:49 | [0, 1, 2, 3, 4, 5] | Iterable<number> |
678+
| tst.ts:493:33:493:33 | 0 | 0 |
679+
| tst.ts:493:36:493:36 | 1 | 1 |
680+
| tst.ts:493:39:493:39 | 2 | 2 |
681+
| tst.ts:493:42:493:42 | 3 | 3 |
682+
| tst.ts:493:45:493:45 | 4 | 4 |
683+
| tst.ts:493:48:493:48 | 5 | 5 |
684+
| tst.ts:493:52:495:3 | (num, i ... d";\\n } | (num: number, index: number) => "even" \| "odd" |
685+
| tst.ts:493:53:493:55 | num | number |
686+
| tst.ts:493:58:493:62 | index | number |
687+
| tst.ts:494:12:494:14 | num | number |
688+
| tst.ts:494:12:494:18 | num % 2 | number |
689+
| tst.ts:494:12:494:24 | num % 2 === 0 | boolean |
690+
| tst.ts:494:12:494:40 | num % 2 ... : "odd" | "even" \| "odd" |
691+
| tst.ts:494:18:494:18 | 2 | 2 |
692+
| tst.ts:494:24:494:24 | 0 | 0 |
693+
| tst.ts:494:28:494:33 | "even" | "even" |
694+
| tst.ts:494:36:494:40 | "odd" | "odd" |
661695
| tstModuleCJS.cts:1:17:1:28 | tstModuleCJS | () => "a" \| "b" |
662696
| tstModuleCJS.cts:2:12:2:15 | Math | Math |
663697
| tstModuleCJS.cts:2:12:2:22 | Math.random | () => number |
@@ -1138,6 +1172,12 @@ getTypeExprType
11381172
| tst.ts:483:46:483:50 | Pair3 | Pair3<T> |
11391173
| tst.ts:483:46:483:58 | Pair3<string> | Pair3<string> |
11401174
| tst.ts:483:52:483:57 | string | string |
1175+
| tst.ts:487:30:487:30 | C | C |
1176+
| tst.ts:487:40:487:45 | string | string |
1177+
| tst.ts:487:56:487:56 | C | C |
1178+
| tst.ts:487:56:487:58 | C[] | C[] |
1179+
| tst.ts:487:76:487:82 | NoInfer | any |
1180+
| tst.ts:487:84:487:84 | C | C |
11411181
| tstModuleCJS.cts:1:33:1:35 | 'a' | "a" |
11421182
| tstModuleCJS.cts:1:33:1:41 | 'a' \| 'b' | "a" \| "b" |
11431183
| tstModuleCJS.cts:1:39:1:41 | 'b' | "b" |
@@ -1357,18 +1397,23 @@ unionIndex
13571397
| "boolean" | 3 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
13581398
| "c" | 2 | "a" \| "b" \| "c" |
13591399
| "circle" | 0 | "circle" \| "square" |
1400+
| "even" | 0 | "even" \| "odd" |
13601401
| "function" | 7 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
13611402
| "green" | 1 | "red" \| "green" \| "blue" |
1403+
| "green" | 1 | "red" \| "green" \| "yellow" |
13621404
| "hello" | 0 | "hello" \| 42 |
13631405
| "number" | 1 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
13641406
| "number" | 1 | keyof TypeMap |
13651407
| "object" | 6 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
1408+
| "odd" | 1 | "even" \| "odd" |
13661409
| "red" | 0 | "red" \| "green" \| "blue" |
1410+
| "red" | 0 | "red" \| "green" \| "yellow" |
13671411
| "square" | 1 | "circle" \| "square" |
13681412
| "string" | 0 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
13691413
| "string" | 0 | keyof TypeMap |
13701414
| "symbol" | 4 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
13711415
| "undefined" | 5 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
1416+
| "yellow" | 2 | "red" \| "green" \| "yellow" |
13721417
| () => number | 0 | (() => number) \| (ClassMethodDecoratorContext<P... |
13731418
| () => number | 1 | void \| (() => number) |
13741419
| ClassMethodDecoratorContext<Person, () => numbe... | 1 | (() => number) \| (ClassMethodDecoratorContext<P... |

javascript/ql/test/library-tests/TypeScript/Types/tst.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,4 +481,16 @@ module TS52 {
481481
type Pair3<T> = [first: T, T];
482482

483483
console.log(["hello", "world"] satisfies Pair3<string>);
484+
}
485+
486+
module TS54 {
487+
function createStreetLight<C extends string>(colors: C[], defaultColor?: NoInfer<C>) {
488+
return colors[0];
489+
}
490+
491+
createStreetLight(["red", "yellow", "green"], "yellow");
492+
493+
const myObj = Object.groupBy([0, 1, 2, 3, 4, 5], (num, index) => {
494+
return num % 2 === 0 ? "even": "odd";
495+
});
484496
}

0 commit comments

Comments
 (0)