Skip to content

Commit 6081111

Browse files
authored
Merge pull request github#16332 from erik-krogh/ts55
JS: upgrade TypeScript to 5.5
2 parents 1cf5e89 + 0de4fd8 commit 6081111

File tree

7 files changed

+277
-38
lines changed

7 files changed

+277
-38
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.10","Swift compiler","``.swift``"
28-
TypeScript [12]_,"2.6-5.4",Standard TypeScript compiler,"``.ts``, ``.tsx``, ``.mts``, ``.cts``"
28+
TypeScript [12]_,"2.6-5.5",Standard TypeScript compiler,"``.ts``, ``.tsx``, ``.mts``, ``.cts``"
2929

3030
.. container:: footnote-group
3131

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

Lines changed: 5 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: 2 additions & 2 deletions
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.4.2"
5+
"typescript": "5.5.2"
66
},
77
"scripts": {
88
"build": "tsc --project tsconfig.json",
@@ -14,4 +14,4 @@
1414
"devDependencies": {
1515
"@types/node": "18.15.3"
1616
}
17-
}
17+
}
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.5.

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: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,43 @@ getExprType
692692
| tst.ts:494:24:494:24 | 0 | 0 |
693693
| tst.ts:494:28:494:33 | "even" | "even" |
694694
| tst.ts:494:36:494:40 | "odd" | "odd" |
695+
| tst.ts:498:8:498:11 | TS55 | typeof TS55 in library-tests/TypeScript/Types/tst.ts |
696+
| tst.ts:499:9:499:15 | strings | string[] |
697+
| tst.ts:499:19:499:32 | (["foo", 123]) | (string \| number)[] |
698+
| tst.ts:499:19:500:11 | (["foo" ... .filter | { <S extends string \| number>(predicate: (value... |
699+
| tst.ts:499:19:500:39 | (["foo" ... tring") | string[] |
700+
| tst.ts:499:20:499:31 | ["foo", 123] | (string \| number)[] |
701+
| tst.ts:499:21:499:25 | "foo" | "foo" |
702+
| tst.ts:499:28:499:30 | 123 | 123 |
703+
| tst.ts:500:6:500:11 | filter | { <S extends string \| number>(predicate: (value... |
704+
| tst.ts:500:13:500:13 | s | string \| number |
705+
| tst.ts:500:13:500:38 | s => ty ... string" | (s: string \| number) => s is string |
706+
| tst.ts:500:18:500:25 | typeof s | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
707+
| tst.ts:500:18:500:38 | typeof ... string" | boolean |
708+
| tst.ts:500:25:500:25 | s | string \| number |
709+
| tst.ts:500:31:500:38 | "string" | "string" |
710+
| tst.ts:502:14:502:16 | str | string |
711+
| tst.ts:502:21:502:27 | strings | string[] |
712+
| tst.ts:503:5:503:7 | str | string |
713+
| tst.ts:503:5:503:19 | str.toLowerCase | () => string |
714+
| tst.ts:503:5:503:21 | str.toLowerCase() | string |
715+
| tst.ts:503:9:503:19 | toLowerCase | () => string |
716+
| tst.ts:506:12:506:13 | f1 | (obj: Record<string, unknown>, key: string) => ... |
717+
| tst.ts:506:15:506:17 | obj | Record<string, unknown> |
718+
| tst.ts:506:45:506:47 | key | string |
719+
| tst.ts:507:9:507:23 | typeof obj[key] | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
720+
| tst.ts:507:9:507:36 | typeof ... string" | boolean |
721+
| tst.ts:507:16:507:18 | obj | Record<string, unknown> |
722+
| tst.ts:507:16:507:23 | obj[key] | unknown |
723+
| tst.ts:507:20:507:22 | key | string |
724+
| tst.ts:507:29:507:36 | "string" | "string" |
725+
| tst.ts:508:11:508:13 | str | string |
726+
| tst.ts:508:17:508:19 | obj | Record<string, unknown> |
727+
| tst.ts:508:17:508:24 | obj[key] | string |
728+
| tst.ts:508:17:508:36 | obj[key].toUpperCase | () => string |
729+
| tst.ts:508:17:508:38 | obj[key ... rCase() | string |
730+
| tst.ts:508:21:508:23 | key | string |
731+
| tst.ts:508:26:508:36 | toUpperCase | () => string |
695732
| tstModuleCJS.cts:1:17:1:28 | tstModuleCJS | () => "a" \| "b" |
696733
| tstModuleCJS.cts:2:12:2:15 | Math | Math |
697734
| tstModuleCJS.cts:2:12:2:22 | Math.random | () => number |
@@ -1178,6 +1215,11 @@ getTypeExprType
11781215
| tst.ts:487:56:487:58 | C[] | C[] |
11791216
| tst.ts:487:76:487:82 | NoInfer | any |
11801217
| tst.ts:487:84:487:84 | C | C |
1218+
| tst.ts:506:20:506:25 | Record | Record<K, T> |
1219+
| tst.ts:506:20:506:42 | Record< ... nknown> | Record<string, unknown> |
1220+
| tst.ts:506:27:506:32 | string | string |
1221+
| tst.ts:506:35:506:41 | unknown | unknown |
1222+
| tst.ts:506:50:506:55 | string | string |
11811223
| tstModuleCJS.cts:1:33:1:35 | 'a' | "a" |
11821224
| tstModuleCJS.cts:1:33:1:41 | 'a' \| 'b' | "a" \| "b" |
11831225
| tstModuleCJS.cts:1:39:1:41 | 'b' | "b" |
@@ -1375,6 +1417,7 @@ unknownType
13751417
| tst.ts:228:12:228:16 | other | unknown |
13761418
| tst.ts:229:16:229:20 | other | unknown |
13771419
| tst.ts:230:20:230:24 | other | unknown |
1420+
| tst.ts:507:16:507:23 | obj[key] | unknown |
13781421
abstractSignature
13791422
| (): HasArea |
13801423
| new (): HasArea |

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,4 +493,19 @@ module TS54 {
493493
const myObj = Object.groupBy([0, 1, 2, 3, 4, 5], (num, index) => {
494494
return num % 2 === 0 ? "even": "odd";
495495
});
496+
}
497+
498+
module TS55 {
499+
const strings = (["foo", 123])
500+
.filter(s => typeof s === "string");
501+
502+
for (const str of strings) {
503+
str.toLowerCase(); // <- string in 5.5, string | number in 5.4
504+
}
505+
506+
function f1(obj: Record<string, unknown>, key: string) {
507+
if (typeof obj[key] === "string") {
508+
var str = obj[key].toUpperCase(); // Now okay, previously was error
509+
}
510+
}
496511
}

0 commit comments

Comments
 (0)