Skip to content

Commit 95a5ec7

Browse files
committed
add test that the new Object.groupBy method has a type
1 parent 9f410eb commit 95a5ec7

File tree

3 files changed

+124
-8
lines changed

3 files changed

+124
-8
lines changed

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

Lines changed: 95 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ nodes
125125
| file://:0:0:0:0 | (Arguments) | semmle.label | (Arguments) |
126126
| file://:0:0:0:0 | (Arguments) | semmle.label | (Arguments) |
127127
| file://:0:0:0:0 | (Arguments) | semmle.label | (Arguments) |
128+
| file://:0:0:0:0 | (Arguments) | semmle.label | (Arguments) |
129+
| file://:0:0:0:0 | (Parameters) | semmle.label | (Parameters) |
128130
| file://:0:0:0:0 | (Parameters) | semmle.label | (Parameters) |
129131
| file://:0:0:0:0 | (Parameters) | semmle.label | (Parameters) |
130132
| file://:0:0:0:0 | (Parameters) | semmle.label | (Parameters) |
@@ -1760,8 +1762,8 @@ nodes
17601762
| tst.ts:483:46:483:50 | [LocalTypeAccess] Pair3 | semmle.label | [LocalTypeAccess] Pair3 |
17611763
| tst.ts:483:46:483:58 | [GenericTypeExpr] Pair3<string> | semmle.label | [GenericTypeExpr] Pair3<string> |
17621764
| tst.ts:483:52:483:57 | [KeywordTypeExpr] string | semmle.label | [KeywordTypeExpr] string |
1763-
| tst.ts:486:1:492:1 | [NamespaceDeclaration] module ... ow"); } | semmle.label | [NamespaceDeclaration] module ... ow"); } |
1764-
| tst.ts:486:1:492:1 | [NamespaceDeclaration] module ... ow"); } | semmle.order | 90 |
1765+
| tst.ts:486:1:496:1 | [NamespaceDeclaration] module ... }); } | semmle.label | [NamespaceDeclaration] module ... }); } |
1766+
| tst.ts:486:1:496:1 | [NamespaceDeclaration] module ... }); } | semmle.order | 90 |
17651767
| tst.ts:486:8:486:11 | [VarDecl] TS54 | semmle.label | [VarDecl] TS54 |
17661768
| tst.ts:487:3:489:3 | [FunctionDeclStmt] functio ... 0]; } | semmle.label | [FunctionDeclStmt] functio ... 0]; } |
17671769
| tst.ts:487:12:487:28 | [VarDecl] createStreetLight | semmle.label | [VarDecl] createStreetLight |
@@ -1788,6 +1790,33 @@ nodes
17881790
| tst.ts:491:29:491:36 | [Literal] "yellow" | semmle.label | [Literal] "yellow" |
17891791
| tst.ts:491:39:491:45 | [Literal] "green" | semmle.label | [Literal] "green" |
17901792
| tst.ts:491:49:491:56 | [Literal] "yellow" | semmle.label | [Literal] "yellow" |
1793+
| tst.ts:493:3:495:5 | [DeclStmt] const myObj = ... | semmle.label | [DeclStmt] const myObj = ... |
1794+
| tst.ts:493:9:493:13 | [VarDecl] myObj | semmle.label | [VarDecl] myObj |
1795+
| tst.ts:493:9:495:4 | [VariableDeclarator] myObj = ... "; }) | semmle.label | [VariableDeclarator] myObj = ... "; }) |
1796+
| tst.ts:493:17:493:22 | [VarRef] Object | semmle.label | [VarRef] Object |
1797+
| tst.ts:493:17:493:30 | [DotExpr] Object.groupBy | semmle.label | [DotExpr] Object.groupBy |
1798+
| tst.ts:493:17:495:4 | [MethodCallExpr] Object. ... "; }) | semmle.label | [MethodCallExpr] Object. ... "; }) |
1799+
| tst.ts:493:24:493:30 | [Label] groupBy | semmle.label | [Label] groupBy |
1800+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | semmle.label | [ArrayExpr] [0, 1, 2, 3, 4, 5] |
1801+
| tst.ts:493:33:493:33 | [Literal] 0 | semmle.label | [Literal] 0 |
1802+
| tst.ts:493:36:493:36 | [Literal] 1 | semmle.label | [Literal] 1 |
1803+
| tst.ts:493:39:493:39 | [Literal] 2 | semmle.label | [Literal] 2 |
1804+
| tst.ts:493:42:493:42 | [Literal] 3 | semmle.label | [Literal] 3 |
1805+
| tst.ts:493:45:493:45 | [Literal] 4 | semmle.label | [Literal] 4 |
1806+
| tst.ts:493:48:493:48 | [Literal] 5 | semmle.label | [Literal] 5 |
1807+
| tst.ts:493:52:495:3 | [ArrowFunctionExpr] (num, i ... d"; } | semmle.label | [ArrowFunctionExpr] (num, i ... d"; } |
1808+
| tst.ts:493:53:493:55 | [SimpleParameter] num | semmle.label | [SimpleParameter] num |
1809+
| tst.ts:493:58:493:62 | [SimpleParameter] index | semmle.label | [SimpleParameter] index |
1810+
| tst.ts:493:68:495:3 | [BlockStmt] { r ... d"; } | semmle.label | [BlockStmt] { r ... d"; } |
1811+
| tst.ts:494:5:494:41 | [ReturnStmt] return ... "odd"; | semmle.label | [ReturnStmt] return ... "odd"; |
1812+
| tst.ts:494:12:494:14 | [VarRef] num | semmle.label | [VarRef] num |
1813+
| tst.ts:494:12:494:18 | [BinaryExpr] num % 2 | semmle.label | [BinaryExpr] num % 2 |
1814+
| tst.ts:494:12:494:24 | [BinaryExpr] num % 2 === 0 | semmle.label | [BinaryExpr] num % 2 === 0 |
1815+
| tst.ts:494:12:494:40 | [ConditionalExpr] num % 2 ... : "odd" | semmle.label | [ConditionalExpr] num % 2 ... : "odd" |
1816+
| tst.ts:494:18:494:18 | [Literal] 2 | semmle.label | [Literal] 2 |
1817+
| tst.ts:494:24:494:24 | [Literal] 0 | semmle.label | [Literal] 0 |
1818+
| tst.ts:494:28:494:33 | [Literal] "even" | semmle.label | [Literal] "even" |
1819+
| tst.ts:494:36:494:40 | [Literal] "odd" | semmle.label | [Literal] "odd" |
17911820
| tstModuleCJS.cts:1:1:3:1 | [ExportDeclaration] export ... 'b'; } | semmle.label | [ExportDeclaration] export ... 'b'; } |
17921821
| tstModuleCJS.cts:1:1:3:1 | [ExportDeclaration] export ... 'b'; } | semmle.order | 91 |
17931822
| tstModuleCJS.cts:1:8:3:1 | [FunctionDeclStmt] functio ... 'b'; } | semmle.label | [FunctionDeclStmt] functio ... 'b'; } |
@@ -2251,6 +2280,10 @@ edges
22512280
| file://:0:0:0:0 | (Arguments) | tst.ts:491:21:491:46 | [ArrayExpr] ["red", ... green"] | semmle.order | 0 |
22522281
| file://:0:0:0:0 | (Arguments) | tst.ts:491:49:491:56 | [Literal] "yellow" | semmle.label | 1 |
22532282
| file://:0:0:0:0 | (Arguments) | tst.ts:491:49:491:56 | [Literal] "yellow" | semmle.order | 1 |
2283+
| file://:0:0:0:0 | (Arguments) | tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | semmle.label | 0 |
2284+
| file://:0:0:0:0 | (Arguments) | tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | semmle.order | 0 |
2285+
| file://:0:0:0:0 | (Arguments) | tst.ts:493:52:495:3 | [ArrowFunctionExpr] (num, i ... d"; } | semmle.label | 1 |
2286+
| file://:0:0:0:0 | (Arguments) | tst.ts:493:52:495:3 | [ArrowFunctionExpr] (num, i ... d"; } | semmle.order | 1 |
22542287
| file://:0:0:0:0 | (Parameters) | tst.ts:14:17:14:17 | [SimpleParameter] x | semmle.label | 0 |
22552288
| file://:0:0:0:0 | (Parameters) | tst.ts:14:17:14:17 | [SimpleParameter] x | semmle.order | 0 |
22562289
| file://:0:0:0:0 | (Parameters) | tst.ts:14:28:14:28 | [SimpleParameter] y | semmle.label | 1 |
@@ -2353,6 +2386,10 @@ edges
23532386
| file://:0:0:0:0 | (Parameters) | tst.ts:487:48:487:53 | [SimpleParameter] colors | semmle.order | 0 |
23542387
| file://:0:0:0:0 | (Parameters) | tst.ts:487:61:487:72 | [SimpleParameter] defaultColor | semmle.label | 1 |
23552388
| file://:0:0:0:0 | (Parameters) | tst.ts:487:61:487:72 | [SimpleParameter] defaultColor | semmle.order | 1 |
2389+
| file://:0:0:0:0 | (Parameters) | tst.ts:493:53:493:55 | [SimpleParameter] num | semmle.label | 0 |
2390+
| file://:0:0:0:0 | (Parameters) | tst.ts:493:53:493:55 | [SimpleParameter] num | semmle.order | 0 |
2391+
| file://:0:0:0:0 | (Parameters) | tst.ts:493:58:493:62 | [SimpleParameter] index | semmle.label | 1 |
2392+
| file://:0:0:0:0 | (Parameters) | tst.ts:493:58:493:62 | [SimpleParameter] index | semmle.order | 1 |
23562393
| file://:0:0:0:0 | (Parameters) | type_alias.ts:14:10:14:17 | [SimpleParameter] property | semmle.label | 0 |
23572394
| file://:0:0:0:0 | (Parameters) | type_alias.ts:14:10:14:17 | [SimpleParameter] property | semmle.order | 0 |
23582395
| file://:0:0:0:0 | (Parameters) | type_alias.ts:21:19:21:21 | [SimpleParameter] key | semmle.label | 0 |
@@ -5223,12 +5260,14 @@ edges
52235260
| tst.ts:483:46:483:58 | [GenericTypeExpr] Pair3<string> | tst.ts:483:46:483:50 | [LocalTypeAccess] Pair3 | semmle.order | 1 |
52245261
| tst.ts:483:46:483:58 | [GenericTypeExpr] Pair3<string> | tst.ts:483:52:483:57 | [KeywordTypeExpr] string | semmle.label | 2 |
52255262
| tst.ts:483:46:483:58 | [GenericTypeExpr] Pair3<string> | tst.ts:483:52:483:57 | [KeywordTypeExpr] string | semmle.order | 2 |
5226-
| tst.ts:486:1:492:1 | [NamespaceDeclaration] module ... ow"); } | tst.ts:486:8:486:11 | [VarDecl] TS54 | semmle.label | 1 |
5227-
| tst.ts:486:1:492:1 | [NamespaceDeclaration] module ... ow"); } | tst.ts:486:8:486:11 | [VarDecl] TS54 | semmle.order | 1 |
5228-
| tst.ts:486:1:492:1 | [NamespaceDeclaration] module ... ow"); } | tst.ts:487:3:489:3 | [FunctionDeclStmt] functio ... 0]; } | semmle.label | 2 |
5229-
| tst.ts:486:1:492:1 | [NamespaceDeclaration] module ... ow"); } | tst.ts:487:3:489:3 | [FunctionDeclStmt] functio ... 0]; } | semmle.order | 2 |
5230-
| tst.ts:486:1:492:1 | [NamespaceDeclaration] module ... ow"); } | tst.ts:491:3:491:58 | [ExprStmt] createS ... llow"); | semmle.label | 3 |
5231-
| tst.ts:486:1:492:1 | [NamespaceDeclaration] module ... ow"); } | tst.ts:491:3:491:58 | [ExprStmt] createS ... llow"); | semmle.order | 3 |
5263+
| tst.ts:486:1:496:1 | [NamespaceDeclaration] module ... }); } | tst.ts:486:8:486:11 | [VarDecl] TS54 | semmle.label | 1 |
5264+
| tst.ts:486:1:496:1 | [NamespaceDeclaration] module ... }); } | tst.ts:486:8:486:11 | [VarDecl] TS54 | semmle.order | 1 |
5265+
| tst.ts:486:1:496:1 | [NamespaceDeclaration] module ... }); } | tst.ts:487:3:489:3 | [FunctionDeclStmt] functio ... 0]; } | semmle.label | 2 |
5266+
| tst.ts:486:1:496:1 | [NamespaceDeclaration] module ... }); } | tst.ts:487:3:489:3 | [FunctionDeclStmt] functio ... 0]; } | semmle.order | 2 |
5267+
| tst.ts:486:1:496:1 | [NamespaceDeclaration] module ... }); } | tst.ts:491:3:491:58 | [ExprStmt] createS ... llow"); | semmle.label | 3 |
5268+
| tst.ts:486:1:496:1 | [NamespaceDeclaration] module ... }); } | tst.ts:491:3:491:58 | [ExprStmt] createS ... llow"); | semmle.order | 3 |
5269+
| tst.ts:486:1:496:1 | [NamespaceDeclaration] module ... }); } | tst.ts:493:3:495:5 | [DeclStmt] const myObj = ... | semmle.label | 4 |
5270+
| tst.ts:486:1:496:1 | [NamespaceDeclaration] module ... }); } | tst.ts:493:3:495:5 | [DeclStmt] const myObj = ... | semmle.order | 4 |
52325271
| tst.ts:487:3:489:3 | [FunctionDeclStmt] functio ... 0]; } | file://:0:0:0:0 | (Parameters) | semmle.label | 1 |
52335272
| tst.ts:487:3:489:3 | [FunctionDeclStmt] functio ... 0]; } | file://:0:0:0:0 | (Parameters) | semmle.order | 1 |
52345273
| tst.ts:487:3:489:3 | [FunctionDeclStmt] functio ... 0]; } | file://:0:0:0:0 | (TypeParameters) | semmle.label | 2 |
@@ -5271,6 +5310,54 @@ edges
52715310
| tst.ts:491:21:491:46 | [ArrayExpr] ["red", ... green"] | tst.ts:491:29:491:36 | [Literal] "yellow" | semmle.order | 2 |
52725311
| tst.ts:491:21:491:46 | [ArrayExpr] ["red", ... green"] | tst.ts:491:39:491:45 | [Literal] "green" | semmle.label | 3 |
52735312
| tst.ts:491:21:491:46 | [ArrayExpr] ["red", ... green"] | tst.ts:491:39:491:45 | [Literal] "green" | semmle.order | 3 |
5313+
| tst.ts:493:3:495:5 | [DeclStmt] const myObj = ... | tst.ts:493:9:495:4 | [VariableDeclarator] myObj = ... "; }) | semmle.label | 1 |
5314+
| tst.ts:493:3:495:5 | [DeclStmt] const myObj = ... | tst.ts:493:9:495:4 | [VariableDeclarator] myObj = ... "; }) | semmle.order | 1 |
5315+
| tst.ts:493:9:495:4 | [VariableDeclarator] myObj = ... "; }) | tst.ts:493:9:493:13 | [VarDecl] myObj | semmle.label | 1 |
5316+
| tst.ts:493:9:495:4 | [VariableDeclarator] myObj = ... "; }) | tst.ts:493:9:493:13 | [VarDecl] myObj | semmle.order | 1 |
5317+
| tst.ts:493:9:495:4 | [VariableDeclarator] myObj = ... "; }) | tst.ts:493:17:495:4 | [MethodCallExpr] Object. ... "; }) | semmle.label | 2 |
5318+
| tst.ts:493:9:495:4 | [VariableDeclarator] myObj = ... "; }) | tst.ts:493:17:495:4 | [MethodCallExpr] Object. ... "; }) | semmle.order | 2 |
5319+
| tst.ts:493:17:493:30 | [DotExpr] Object.groupBy | tst.ts:493:17:493:22 | [VarRef] Object | semmle.label | 1 |
5320+
| tst.ts:493:17:493:30 | [DotExpr] Object.groupBy | tst.ts:493:17:493:22 | [VarRef] Object | semmle.order | 1 |
5321+
| tst.ts:493:17:493:30 | [DotExpr] Object.groupBy | tst.ts:493:24:493:30 | [Label] groupBy | semmle.label | 2 |
5322+
| tst.ts:493:17:493:30 | [DotExpr] Object.groupBy | tst.ts:493:24:493:30 | [Label] groupBy | semmle.order | 2 |
5323+
| tst.ts:493:17:495:4 | [MethodCallExpr] Object. ... "; }) | file://:0:0:0:0 | (Arguments) | semmle.label | 1 |
5324+
| tst.ts:493:17:495:4 | [MethodCallExpr] Object. ... "; }) | file://:0:0:0:0 | (Arguments) | semmle.order | 1 |
5325+
| tst.ts:493:17:495:4 | [MethodCallExpr] Object. ... "; }) | tst.ts:493:17:493:30 | [DotExpr] Object.groupBy | semmle.label | 0 |
5326+
| tst.ts:493:17:495:4 | [MethodCallExpr] Object. ... "; }) | tst.ts:493:17:493:30 | [DotExpr] Object.groupBy | semmle.order | 0 |
5327+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:33:493:33 | [Literal] 0 | semmle.label | 1 |
5328+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:33:493:33 | [Literal] 0 | semmle.order | 1 |
5329+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:36:493:36 | [Literal] 1 | semmle.label | 2 |
5330+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:36:493:36 | [Literal] 1 | semmle.order | 2 |
5331+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:39:493:39 | [Literal] 2 | semmle.label | 3 |
5332+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:39:493:39 | [Literal] 2 | semmle.order | 3 |
5333+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:42:493:42 | [Literal] 3 | semmle.label | 4 |
5334+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:42:493:42 | [Literal] 3 | semmle.order | 4 |
5335+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:45:493:45 | [Literal] 4 | semmle.label | 5 |
5336+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:45:493:45 | [Literal] 4 | semmle.order | 5 |
5337+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:48:493:48 | [Literal] 5 | semmle.label | 6 |
5338+
| tst.ts:493:32:493:49 | [ArrayExpr] [0, 1, 2, 3, 4, 5] | tst.ts:493:48:493:48 | [Literal] 5 | semmle.order | 6 |
5339+
| tst.ts:493:52:495:3 | [ArrowFunctionExpr] (num, i ... d"; } | file://:0:0:0:0 | (Parameters) | semmle.label | 1 |
5340+
| tst.ts:493:52:495:3 | [ArrowFunctionExpr] (num, i ... d"; } | file://:0:0:0:0 | (Parameters) | semmle.order | 1 |
5341+
| tst.ts:493:52:495:3 | [ArrowFunctionExpr] (num, i ... d"; } | tst.ts:493:68:495:3 | [BlockStmt] { r ... d"; } | semmle.label | 5 |
5342+
| tst.ts:493:52:495:3 | [ArrowFunctionExpr] (num, i ... d"; } | tst.ts:493:68:495:3 | [BlockStmt] { r ... d"; } | semmle.order | 5 |
5343+
| tst.ts:493:68:495:3 | [BlockStmt] { r ... d"; } | tst.ts:494:5:494:41 | [ReturnStmt] return ... "odd"; | semmle.label | 1 |
5344+
| tst.ts:493:68:495:3 | [BlockStmt] { r ... d"; } | tst.ts:494:5:494:41 | [ReturnStmt] return ... "odd"; | semmle.order | 1 |
5345+
| tst.ts:494:5:494:41 | [ReturnStmt] return ... "odd"; | tst.ts:494:12:494:40 | [ConditionalExpr] num % 2 ... : "odd" | semmle.label | 1 |
5346+
| tst.ts:494:5:494:41 | [ReturnStmt] return ... "odd"; | tst.ts:494:12:494:40 | [ConditionalExpr] num % 2 ... : "odd" | semmle.order | 1 |
5347+
| tst.ts:494:12:494:18 | [BinaryExpr] num % 2 | tst.ts:494:12:494:14 | [VarRef] num | semmle.label | 1 |
5348+
| tst.ts:494:12:494:18 | [BinaryExpr] num % 2 | tst.ts:494:12:494:14 | [VarRef] num | semmle.order | 1 |
5349+
| tst.ts:494:12:494:18 | [BinaryExpr] num % 2 | tst.ts:494:18:494:18 | [Literal] 2 | semmle.label | 2 |
5350+
| tst.ts:494:12:494:18 | [BinaryExpr] num % 2 | tst.ts:494:18:494:18 | [Literal] 2 | semmle.order | 2 |
5351+
| tst.ts:494:12:494:24 | [BinaryExpr] num % 2 === 0 | tst.ts:494:12:494:18 | [BinaryExpr] num % 2 | semmle.label | 1 |
5352+
| tst.ts:494:12:494:24 | [BinaryExpr] num % 2 === 0 | tst.ts:494:12:494:18 | [BinaryExpr] num % 2 | semmle.order | 1 |
5353+
| tst.ts:494:12:494:24 | [BinaryExpr] num % 2 === 0 | tst.ts:494:24:494:24 | [Literal] 0 | semmle.label | 2 |
5354+
| tst.ts:494:12:494:24 | [BinaryExpr] num % 2 === 0 | tst.ts:494:24:494:24 | [Literal] 0 | semmle.order | 2 |
5355+
| tst.ts:494:12:494:40 | [ConditionalExpr] num % 2 ... : "odd" | tst.ts:494:12:494:24 | [BinaryExpr] num % 2 === 0 | semmle.label | 1 |
5356+
| tst.ts:494:12:494:40 | [ConditionalExpr] num % 2 ... : "odd" | tst.ts:494:12:494:24 | [BinaryExpr] num % 2 === 0 | semmle.order | 1 |
5357+
| tst.ts:494:12:494:40 | [ConditionalExpr] num % 2 ... : "odd" | tst.ts:494:28:494:33 | [Literal] "even" | semmle.label | 2 |
5358+
| tst.ts:494:12:494:40 | [ConditionalExpr] num % 2 ... : "odd" | tst.ts:494:28:494:33 | [Literal] "even" | semmle.order | 2 |
5359+
| tst.ts:494:12:494:40 | [ConditionalExpr] num % 2 ... : "odd" | tst.ts:494:36:494:40 | [Literal] "odd" | semmle.label | 3 |
5360+
| tst.ts:494:12:494:40 | [ConditionalExpr] num % 2 ... : "odd" | tst.ts:494:36:494:40 | [Literal] "odd" | semmle.order | 3 |
52745361
| tstModuleCJS.cts:1:1:3:1 | [ExportDeclaration] export ... 'b'; } | tstModuleCJS.cts:1:8:3:1 | [FunctionDeclStmt] functio ... 'b'; } | semmle.label | 1 |
52755362
| tstModuleCJS.cts:1:1:3:1 | [ExportDeclaration] export ... 'b'; } | tstModuleCJS.cts:1:8:3:1 | [FunctionDeclStmt] functio ... 'b'; } | semmle.order | 1 |
52765363
| tstModuleCJS.cts:1:8:3:1 | [FunctionDeclStmt] functio ... 'b'; } | tstModuleCJS.cts:1:17:1:28 | [VarDecl] tstModuleCJS | semmle.label | 0 |

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,29 @@ getExprType
669669
| tst.ts:491:29:491:36 | "yellow" | "yellow" |
670670
| tst.ts:491:39:491:45 | "green" | "green" |
671671
| 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" |
672695
| tstModuleCJS.cts:1:17:1:28 | tstModuleCJS | () => "a" \| "b" |
673696
| tstModuleCJS.cts:2:12:2:15 | Math | Math |
674697
| tstModuleCJS.cts:2:12:2:22 | Math.random | () => number |
@@ -1374,13 +1397,15 @@ unionIndex
13741397
| "boolean" | 3 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
13751398
| "c" | 2 | "a" \| "b" \| "c" |
13761399
| "circle" | 0 | "circle" \| "square" |
1400+
| "even" | 0 | "even" \| "odd" |
13771401
| "function" | 7 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
13781402
| "green" | 1 | "red" \| "green" \| "blue" |
13791403
| "green" | 1 | "red" \| "green" \| "yellow" |
13801404
| "hello" | 0 | "hello" \| 42 |
13811405
| "number" | 1 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
13821406
| "number" | 1 | keyof TypeMap |
13831407
| "object" | 6 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
1408+
| "odd" | 1 | "even" \| "odd" |
13841409
| "red" | 0 | "red" \| "green" \| "blue" |
13851410
| "red" | 0 | "red" \| "green" \| "yellow" |
13861411
| "square" | 1 | "circle" \| "square" |

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,4 +489,8 @@ module TS54 {
489489
}
490490

491491
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+
});
492496
}

0 commit comments

Comments
 (0)