Skip to content

Commit 65567fa

Browse files
committed
add test for the more precise type-narrowing with the in operator
1 parent e98d1df commit 65567fa

File tree

3 files changed

+129
-12
lines changed

3 files changed

+129
-12
lines changed

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

Lines changed: 93 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ nodes
135135
| file://:0:0:0:0 | (Parameters) | semmle.label | (Parameters) |
136136
| file://:0:0:0:0 | (Parameters) | semmle.label | (Parameters) |
137137
| file://:0:0:0:0 | (Parameters) | semmle.label | (Parameters) |
138+
| file://:0:0:0:0 | (Parameters) | semmle.label | (Parameters) |
138139
| file://:0:0:0:0 | (TypeParameters) | semmle.label | (TypeParameters) |
139140
| file://:0:0:0:0 | (TypeParameters) | semmle.label | (TypeParameters) |
140141
| file://:0:0:0:0 | (TypeParameters) | semmle.label | (TypeParameters) |
@@ -1425,8 +1426,8 @@ nodes
14251426
| tst.ts:385:56:385:56 | [Literal] 0 | semmle.label | [Literal] 0 |
14261427
| tst.ts:385:59:385:63 | [Literal] false | semmle.label | [Literal] false |
14271428
| tst.ts:385:66:385:71 | [Literal] "bye!" | semmle.label | [Literal] "bye!" |
1428-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | semmle.label | [NamespaceDeclaration] module ... t(0); } |
1429-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | semmle.order | 85 |
1429+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | semmle.label | [NamespaceDeclaration] module ... } } } |
1430+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | semmle.order | 85 |
14301431
| tst.ts:390:8:390:11 | [VarDecl] TS49 | semmle.label | [VarDecl] TS49 |
14311432
| tst.ts:391:3:391:41 | [TypeAliasDeclaration,TypeDefinition] type Co ... "blue"; | semmle.label | [TypeAliasDeclaration,TypeDefinition] type Co ... "blue"; |
14321433
| tst.ts:391:8:391:13 | [Identifier] Colors | semmle.label | [Identifier] Colors |
@@ -1479,6 +1480,32 @@ nodes
14791480
| tst.ts:402:32:402:34 | [Label] red | semmle.label | [Label] red |
14801481
| tst.ts:402:36:402:37 | [Label] at | semmle.label | [Label] at |
14811482
| tst.ts:402:39:402:39 | [Literal] 0 | semmle.label | [Literal] 0 |
1483+
| tst.ts:404:3:406:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | semmle.label | [InterfaceDeclaration,TypeDefinition] interfa ... er; } |
1484+
| tst.ts:404:13:404:18 | [Identifier] RGBObj | semmle.label | [Identifier] RGBObj |
1485+
| tst.ts:405:5:405:7 | [Label] red | semmle.label | [Label] red |
1486+
| tst.ts:405:5:405:16 | [FieldDeclaration] red: number; | semmle.label | [FieldDeclaration] red: number; |
1487+
| tst.ts:405:10:405:15 | [KeywordTypeExpr] number | semmle.label | [KeywordTypeExpr] number |
1488+
| tst.ts:408:3:410:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | semmle.label | [InterfaceDeclaration,TypeDefinition] interfa ... er; } |
1489+
| tst.ts:408:13:408:18 | [Identifier] HSVObj | semmle.label | [Identifier] HSVObj |
1490+
| tst.ts:409:5:409:7 | [Label] hue | semmle.label | [Label] hue |
1491+
| tst.ts:409:5:409:16 | [FieldDeclaration] hue: number; | semmle.label | [FieldDeclaration] hue: number; |
1492+
| tst.ts:409:10:409:15 | [KeywordTypeExpr] number | semmle.label | [KeywordTypeExpr] number |
1493+
| tst.ts:412:3:416:3 | [FunctionDeclStmt] functio ... } } | semmle.label | [FunctionDeclStmt] functio ... } } |
1494+
| tst.ts:412:12:412:19 | [VarDecl] setColor | semmle.label | [VarDecl] setColor |
1495+
| tst.ts:412:21:412:25 | [SimpleParameter] color | semmle.label | [SimpleParameter] color |
1496+
| tst.ts:412:28:412:33 | [LocalTypeAccess] RGBObj | semmle.label | [LocalTypeAccess] RGBObj |
1497+
| tst.ts:412:28:412:42 | [UnionTypeExpr] RGBObj \| HSVObj | semmle.label | [UnionTypeExpr] RGBObj \| HSVObj |
1498+
| tst.ts:412:37:412:42 | [LocalTypeAccess] HSVObj | semmle.label | [LocalTypeAccess] HSVObj |
1499+
| tst.ts:412:45:416:3 | [BlockStmt] { i ... } } | semmle.label | [BlockStmt] { i ... } } |
1500+
| tst.ts:413:5:415:5 | [IfStmt] if ("hu ... j } | semmle.label | [IfStmt] if ("hu ... j } |
1501+
| tst.ts:413:9:413:13 | [Literal] "hue" | semmle.label | [Literal] "hue" |
1502+
| tst.ts:413:9:413:22 | [BinaryExpr] "hue" in color | semmle.label | [BinaryExpr] "hue" in color |
1503+
| tst.ts:413:18:413:22 | [VarRef] color | semmle.label | [VarRef] color |
1504+
| tst.ts:413:25:415:5 | [BlockStmt] { ... j } | semmle.label | [BlockStmt] { ... j } |
1505+
| tst.ts:414:7:414:20 | [DeclStmt] let h = ... | semmle.label | [DeclStmt] let h = ... |
1506+
| tst.ts:414:11:414:11 | [VarDecl] h | semmle.label | [VarDecl] h |
1507+
| tst.ts:414:11:414:19 | [VariableDeclarator] h = color | semmle.label | [VariableDeclarator] h = color |
1508+
| tst.ts:414:15:414:19 | [VarRef] color | semmle.label | [VarRef] color |
14821509
| tstModuleCJS.cts:1:1:3:1 | [ExportDeclaration] export ... 'b'; } | semmle.label | [ExportDeclaration] export ... 'b'; } |
14831510
| tstModuleCJS.cts:1:1:3:1 | [ExportDeclaration] export ... 'b'; } | semmle.order | 86 |
14841511
| tstModuleCJS.cts:1:8:3:1 | [FunctionDeclStmt] functio ... 'b'; } | semmle.label | [FunctionDeclStmt] functio ... 'b'; } |
@@ -1974,6 +2001,8 @@ edges
19742001
| file://:0:0:0:0 | (Parameters) | tst.ts:383:40:383:40 | [SimpleParameter] x | semmle.order | 0 |
19752002
| file://:0:0:0:0 | (Parameters) | tst.ts:383:46:383:46 | [SimpleParameter] y | semmle.label | 1 |
19762003
| file://:0:0:0:0 | (Parameters) | tst.ts:383:46:383:46 | [SimpleParameter] y | semmle.order | 1 |
2004+
| file://:0:0:0:0 | (Parameters) | tst.ts:412:21:412:25 | [SimpleParameter] color | semmle.label | 0 |
2005+
| file://:0:0:0:0 | (Parameters) | tst.ts:412:21:412:25 | [SimpleParameter] color | semmle.order | 0 |
19772006
| file://:0:0:0:0 | (Parameters) | type_alias.ts:14:10:14:17 | [SimpleParameter] property | semmle.label | 0 |
19782007
| file://:0:0:0:0 | (Parameters) | type_alias.ts:14:10:14:17 | [SimpleParameter] property | semmle.order | 0 |
19792008
| file://:0:0:0:0 | (Parameters) | type_alias.ts:21:19:21:21 | [SimpleParameter] key | semmle.label | 0 |
@@ -4260,16 +4289,22 @@ edges
42604289
| tst.ts:385:55:385:72 | [ArrayExpr] [0, false, "bye!"] | tst.ts:385:59:385:63 | [Literal] false | semmle.order | 2 |
42614290
| tst.ts:385:55:385:72 | [ArrayExpr] [0, false, "bye!"] | tst.ts:385:66:385:71 | [Literal] "bye!" | semmle.label | 3 |
42624291
| tst.ts:385:55:385:72 | [ArrayExpr] [0, false, "bye!"] | tst.ts:385:66:385:71 | [Literal] "bye!" | semmle.order | 3 |
4263-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | tst.ts:390:8:390:11 | [VarDecl] TS49 | semmle.label | 1 |
4264-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | tst.ts:390:8:390:11 | [VarDecl] TS49 | semmle.order | 1 |
4265-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | tst.ts:391:3:391:41 | [TypeAliasDeclaration,TypeDefinition] type Co ... "blue"; | semmle.label | 2 |
4266-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | tst.ts:391:3:391:41 | [TypeAliasDeclaration,TypeDefinition] type Co ... "blue"; | semmle.order | 2 |
4267-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | tst.ts:393:3:393:56 | [TypeAliasDeclaration,TypeDefinition] type RG ... umber]; | semmle.label | 3 |
4268-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | tst.ts:393:3:393:56 | [TypeAliasDeclaration,TypeDefinition] type RG ... umber]; | semmle.order | 3 |
4269-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | tst.ts:395:3:399:43 | [DeclStmt] const palette = ... | semmle.label | 4 |
4270-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | tst.ts:395:3:399:43 | [DeclStmt] const palette = ... | semmle.order | 4 |
4271-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | tst.ts:402:3:402:41 | [DeclStmt] const redComponent = ... | semmle.label | 5 |
4272-
| tst.ts:390:1:403:1 | [NamespaceDeclaration] module ... t(0); } | tst.ts:402:3:402:41 | [DeclStmt] const redComponent = ... | semmle.order | 5 |
4292+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:390:8:390:11 | [VarDecl] TS49 | semmle.label | 1 |
4293+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:390:8:390:11 | [VarDecl] TS49 | semmle.order | 1 |
4294+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:391:3:391:41 | [TypeAliasDeclaration,TypeDefinition] type Co ... "blue"; | semmle.label | 2 |
4295+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:391:3:391:41 | [TypeAliasDeclaration,TypeDefinition] type Co ... "blue"; | semmle.order | 2 |
4296+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:393:3:393:56 | [TypeAliasDeclaration,TypeDefinition] type RG ... umber]; | semmle.label | 3 |
4297+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:393:3:393:56 | [TypeAliasDeclaration,TypeDefinition] type RG ... umber]; | semmle.order | 3 |
4298+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:395:3:399:43 | [DeclStmt] const palette = ... | semmle.label | 4 |
4299+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:395:3:399:43 | [DeclStmt] const palette = ... | semmle.order | 4 |
4300+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:402:3:402:41 | [DeclStmt] const redComponent = ... | semmle.label | 5 |
4301+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:402:3:402:41 | [DeclStmt] const redComponent = ... | semmle.order | 5 |
4302+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:404:3:406:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | semmle.label | 6 |
4303+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:404:3:406:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | semmle.order | 6 |
4304+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:408:3:410:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | semmle.label | 7 |
4305+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:408:3:410:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | semmle.order | 7 |
4306+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:412:3:416:3 | [FunctionDeclStmt] functio ... } } | semmle.label | 8 |
4307+
| tst.ts:390:1:417:1 | [NamespaceDeclaration] module ... } } } | tst.ts:412:3:416:3 | [FunctionDeclStmt] functio ... } } | semmle.order | 8 |
42734308
| tst.ts:391:3:391:41 | [TypeAliasDeclaration,TypeDefinition] type Co ... "blue"; | tst.ts:391:8:391:13 | [Identifier] Colors | semmle.label | 1 |
42744309
| tst.ts:391:3:391:41 | [TypeAliasDeclaration,TypeDefinition] type Co ... "blue"; | tst.ts:391:8:391:13 | [Identifier] Colors | semmle.order | 1 |
42754310
| tst.ts:391:3:391:41 | [TypeAliasDeclaration,TypeDefinition] type Co ... "blue"; | tst.ts:391:17:391:40 | [UnionTypeExpr] "red" \| ... "blue" | semmle.label | 2 |
@@ -4364,6 +4399,52 @@ edges
43644399
| tst.ts:402:24:402:40 | [MethodCallExpr] palette.red.at(0) | file://:0:0:0:0 | (Arguments) | semmle.order | 1 |
43654400
| tst.ts:402:24:402:40 | [MethodCallExpr] palette.red.at(0) | tst.ts:402:24:402:37 | [DotExpr] palette.red.at | semmle.label | 0 |
43664401
| tst.ts:402:24:402:40 | [MethodCallExpr] palette.red.at(0) | tst.ts:402:24:402:37 | [DotExpr] palette.red.at | semmle.order | 0 |
4402+
| tst.ts:404:3:406:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | tst.ts:404:13:404:18 | [Identifier] RGBObj | semmle.label | 1 |
4403+
| tst.ts:404:3:406:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | tst.ts:404:13:404:18 | [Identifier] RGBObj | semmle.order | 1 |
4404+
| tst.ts:404:3:406:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | tst.ts:405:5:405:16 | [FieldDeclaration] red: number; | semmle.label | 2 |
4405+
| tst.ts:404:3:406:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | tst.ts:405:5:405:16 | [FieldDeclaration] red: number; | semmle.order | 2 |
4406+
| tst.ts:405:5:405:16 | [FieldDeclaration] red: number; | tst.ts:405:5:405:7 | [Label] red | semmle.label | 1 |
4407+
| tst.ts:405:5:405:16 | [FieldDeclaration] red: number; | tst.ts:405:5:405:7 | [Label] red | semmle.order | 1 |
4408+
| tst.ts:405:5:405:16 | [FieldDeclaration] red: number; | tst.ts:405:10:405:15 | [KeywordTypeExpr] number | semmle.label | 2 |
4409+
| tst.ts:405:5:405:16 | [FieldDeclaration] red: number; | tst.ts:405:10:405:15 | [KeywordTypeExpr] number | semmle.order | 2 |
4410+
| tst.ts:408:3:410:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | tst.ts:408:13:408:18 | [Identifier] HSVObj | semmle.label | 1 |
4411+
| tst.ts:408:3:410:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | tst.ts:408:13:408:18 | [Identifier] HSVObj | semmle.order | 1 |
4412+
| tst.ts:408:3:410:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | tst.ts:409:5:409:16 | [FieldDeclaration] hue: number; | semmle.label | 2 |
4413+
| tst.ts:408:3:410:3 | [InterfaceDeclaration,TypeDefinition] interfa ... er; } | tst.ts:409:5:409:16 | [FieldDeclaration] hue: number; | semmle.order | 2 |
4414+
| tst.ts:409:5:409:16 | [FieldDeclaration] hue: number; | tst.ts:409:5:409:7 | [Label] hue | semmle.label | 1 |
4415+
| tst.ts:409:5:409:16 | [FieldDeclaration] hue: number; | tst.ts:409:5:409:7 | [Label] hue | semmle.order | 1 |
4416+
| tst.ts:409:5:409:16 | [FieldDeclaration] hue: number; | tst.ts:409:10:409:15 | [KeywordTypeExpr] number | semmle.label | 2 |
4417+
| tst.ts:409:5:409:16 | [FieldDeclaration] hue: number; | tst.ts:409:10:409:15 | [KeywordTypeExpr] number | semmle.order | 2 |
4418+
| tst.ts:412:3:416:3 | [FunctionDeclStmt] functio ... } } | file://:0:0:0:0 | (Parameters) | semmle.label | 1 |
4419+
| tst.ts:412:3:416:3 | [FunctionDeclStmt] functio ... } } | file://:0:0:0:0 | (Parameters) | semmle.order | 1 |
4420+
| tst.ts:412:3:416:3 | [FunctionDeclStmt] functio ... } } | tst.ts:412:12:412:19 | [VarDecl] setColor | semmle.label | 0 |
4421+
| tst.ts:412:3:416:3 | [FunctionDeclStmt] functio ... } } | tst.ts:412:12:412:19 | [VarDecl] setColor | semmle.order | 0 |
4422+
| tst.ts:412:3:416:3 | [FunctionDeclStmt] functio ... } } | tst.ts:412:45:416:3 | [BlockStmt] { i ... } } | semmle.label | 5 |
4423+
| tst.ts:412:3:416:3 | [FunctionDeclStmt] functio ... } } | tst.ts:412:45:416:3 | [BlockStmt] { i ... } } | semmle.order | 5 |
4424+
| tst.ts:412:21:412:25 | [SimpleParameter] color | tst.ts:412:28:412:42 | [UnionTypeExpr] RGBObj \| HSVObj | semmle.label | 0 |
4425+
| tst.ts:412:21:412:25 | [SimpleParameter] color | tst.ts:412:28:412:42 | [UnionTypeExpr] RGBObj \| HSVObj | semmle.order | 0 |
4426+
| tst.ts:412:28:412:42 | [UnionTypeExpr] RGBObj \| HSVObj | tst.ts:412:28:412:33 | [LocalTypeAccess] RGBObj | semmle.label | 1 |
4427+
| tst.ts:412:28:412:42 | [UnionTypeExpr] RGBObj \| HSVObj | tst.ts:412:28:412:33 | [LocalTypeAccess] RGBObj | semmle.order | 1 |
4428+
| tst.ts:412:28:412:42 | [UnionTypeExpr] RGBObj \| HSVObj | tst.ts:412:37:412:42 | [LocalTypeAccess] HSVObj | semmle.label | 2 |
4429+
| tst.ts:412:28:412:42 | [UnionTypeExpr] RGBObj \| HSVObj | tst.ts:412:37:412:42 | [LocalTypeAccess] HSVObj | semmle.order | 2 |
4430+
| tst.ts:412:45:416:3 | [BlockStmt] { i ... } } | tst.ts:413:5:415:5 | [IfStmt] if ("hu ... j } | semmle.label | 1 |
4431+
| tst.ts:412:45:416:3 | [BlockStmt] { i ... } } | tst.ts:413:5:415:5 | [IfStmt] if ("hu ... j } | semmle.order | 1 |
4432+
| tst.ts:413:5:415:5 | [IfStmt] if ("hu ... j } | tst.ts:413:9:413:22 | [BinaryExpr] "hue" in color | semmle.label | 1 |
4433+
| tst.ts:413:5:415:5 | [IfStmt] if ("hu ... j } | tst.ts:413:9:413:22 | [BinaryExpr] "hue" in color | semmle.order | 1 |
4434+
| tst.ts:413:5:415:5 | [IfStmt] if ("hu ... j } | tst.ts:413:25:415:5 | [BlockStmt] { ... j } | semmle.label | 2 |
4435+
| tst.ts:413:5:415:5 | [IfStmt] if ("hu ... j } | tst.ts:413:25:415:5 | [BlockStmt] { ... j } | semmle.order | 2 |
4436+
| tst.ts:413:9:413:22 | [BinaryExpr] "hue" in color | tst.ts:413:9:413:13 | [Literal] "hue" | semmle.label | 1 |
4437+
| tst.ts:413:9:413:22 | [BinaryExpr] "hue" in color | tst.ts:413:9:413:13 | [Literal] "hue" | semmle.order | 1 |
4438+
| tst.ts:413:9:413:22 | [BinaryExpr] "hue" in color | tst.ts:413:18:413:22 | [VarRef] color | semmle.label | 2 |
4439+
| tst.ts:413:9:413:22 | [BinaryExpr] "hue" in color | tst.ts:413:18:413:22 | [VarRef] color | semmle.order | 2 |
4440+
| tst.ts:413:25:415:5 | [BlockStmt] { ... j } | tst.ts:414:7:414:20 | [DeclStmt] let h = ... | semmle.label | 1 |
4441+
| tst.ts:413:25:415:5 | [BlockStmt] { ... j } | tst.ts:414:7:414:20 | [DeclStmt] let h = ... | semmle.order | 1 |
4442+
| tst.ts:414:7:414:20 | [DeclStmt] let h = ... | tst.ts:414:11:414:19 | [VariableDeclarator] h = color | semmle.label | 1 |
4443+
| tst.ts:414:7:414:20 | [DeclStmt] let h = ... | tst.ts:414:11:414:19 | [VariableDeclarator] h = color | semmle.order | 1 |
4444+
| tst.ts:414:11:414:19 | [VariableDeclarator] h = color | tst.ts:414:11:414:11 | [VarDecl] h | semmle.label | 1 |
4445+
| tst.ts:414:11:414:19 | [VariableDeclarator] h = color | tst.ts:414:11:414:11 | [VarDecl] h | semmle.order | 1 |
4446+
| tst.ts:414:11:414:19 | [VariableDeclarator] h = color | tst.ts:414:15:414:19 | [VarRef] color | semmle.label | 2 |
4447+
| tst.ts:414:11:414:19 | [VariableDeclarator] h = color | tst.ts:414:15:414:19 | [VarRef] color | semmle.order | 2 |
43674448
| tstModuleCJS.cts:1:1:3:1 | [ExportDeclaration] export ... 'b'; } | tstModuleCJS.cts:1:8:3:1 | [FunctionDeclStmt] functio ... 'b'; } | semmle.label | 1 |
43684449
| tstModuleCJS.cts:1:1:3:1 | [ExportDeclaration] export ... 'b'; } | tstModuleCJS.cts:1:8:3:1 | [FunctionDeclStmt] functio ... 'b'; } | semmle.order | 1 |
43694450
| 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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,15 @@ getExprType
543543
| tst.ts:402:32:402:34 | red | [red: number, green: number, blue: number] |
544544
| tst.ts:402:36:402:37 | at | (index: number) => number |
545545
| tst.ts:402:39:402:39 | 0 | 0 |
546+
| tst.ts:405:5:405:7 | red | number |
547+
| tst.ts:409:5:409:7 | hue | number |
548+
| tst.ts:412:12:412:19 | setColor | (color: RGBObj \| HSVObj) => void |
549+
| tst.ts:412:21:412:25 | color | RGBObj \| HSVObj |
550+
| tst.ts:413:9:413:13 | "hue" | "hue" |
551+
| tst.ts:413:9:413:22 | "hue" in color | boolean |
552+
| tst.ts:413:18:413:22 | color | RGBObj \| HSVObj |
553+
| tst.ts:414:11:414:11 | h | HSVObj |
554+
| tst.ts:414:15:414:19 | color | HSVObj |
546555
| tstModuleCJS.cts:1:17:1:28 | tstModuleCJS | () => "a" \| "b" |
547556
| tstModuleCJS.cts:2:12:2:15 | Math | Math |
548557
| tstModuleCJS.cts:2:12:2:22 | Math.random | () => number |
@@ -650,6 +659,8 @@ getTypeDefinitionType
650659
| tst.ts:381:5:381:73 | type So ... never; | 100 |
651660
| tst.ts:391:3:391:41 | type Co ... "blue"; | Colors |
652661
| tst.ts:393:3:393:56 | type RG ... umber]; | RGB |
662+
| tst.ts:404:3:406:3 | interfa ... er;\\n } | RGBObj |
663+
| tst.ts:408:3:410:3 | interfa ... er;\\n } | HSVObj |
653664
| type_alias.ts:1:1:1:17 | type B = boolean; | boolean |
654665
| type_alias.ts:5:1:5:50 | type Va ... ay<T>>; | ValueOrArray<T> |
655666
| type_alias.ts:9:1:15:13 | type Js ... Json[]; | Json |
@@ -966,6 +977,13 @@ getTypeExprType
966977
| tst.ts:399:30:399:35 | string | string |
967978
| tst.ts:399:30:399:41 | string \| RGB | string \| RGB |
968979
| tst.ts:399:39:399:41 | RGB | RGB |
980+
| tst.ts:404:13:404:18 | RGBObj | RGBObj |
981+
| tst.ts:405:10:405:15 | number | number |
982+
| tst.ts:408:13:408:18 | HSVObj | HSVObj |
983+
| tst.ts:409:10:409:15 | number | number |
984+
| tst.ts:412:28:412:33 | RGBObj | RGBObj |
985+
| tst.ts:412:28:412:42 | RGBObj \| HSVObj | RGBObj \| HSVObj |
986+
| tst.ts:412:37:412:42 | HSVObj | HSVObj |
969987
| tstModuleCJS.cts:1:33:1:35 | 'a' | "a" |
970988
| tstModuleCJS.cts:1:33:1:41 | 'a' \| 'b' | "a" \| "b" |
971989
| tstModuleCJS.cts:1:39:1:41 | 'b' | "b" |
@@ -1061,6 +1079,7 @@ referenceDefinition
10611079
| Foo | tst.ts:165:5:167:5 | interfa ... ;\\n } |
10621080
| Foo | tst.ts:179:3:192:3 | class F ... \\n } |
10631081
| Func | tst.ts:289:3:289:63 | type Fu ... > void; |
1082+
| HSVObj | tst.ts:408:3:410:3 | interfa ... er;\\n } |
10641083
| HasArea | tst.ts:58:1:60:1 | interfa ... mber;\\n} |
10651084
| I<S> | type_definitions.ts:3:1:5:1 | interfa ... x: S;\\n} |
10661085
| I<number> | type_definitions.ts:3:1:5:1 | interfa ... x: S;\\n} |
@@ -1070,6 +1089,7 @@ referenceDefinition
10701089
| NonAbstractDummy | tst.ts:54:1:56:1 | interfa ... mber;\\n} |
10711090
| Person | tst.ts:222:3:234:3 | class P ... }\\n } |
10721091
| RGB | tst.ts:393:3:393:56 | type RG ... umber]; |
1092+
| RGBObj | tst.ts:404:3:406:3 | interfa ... er;\\n } |
10731093
| Shape | tst.ts:140:3:142:47 | type Sh ... mber }; |
10741094
| State<T> | tst.ts:342:1:345:1 | interfa ... void;\\n} |
10751095
| State<number> | tst.ts:342:1:345:1 | interfa ... void;\\n} |
@@ -1174,11 +1194,13 @@ unionIndex
11741194
| "undefined" | 5 | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
11751195
| Error | 1 | Success \| Error |
11761196
| Error | 1 | string \| Error |
1197+
| HSVObj | 1 | RGBObj \| HSVObj |
11771198
| Json[] | 5 | string \| number \| boolean \| { [property: string... |
11781199
| Promise<number> | 2 | boolean \| Promise<number> |
11791200
| PromiseLike<TResult1> | 1 | TResult1 \| PromiseLike<TResult1> |
11801201
| PromiseLike<TResult2> | 1 | TResult2 \| PromiseLike<TResult2> |
11811202
| RGB | 1 | string \| RGB |
1203+
| RGBObj | 0 | RGBObj \| HSVObj |
11821204
| Success | 0 | Success \| Error |
11831205
| T | 0 | T \| ValueOrArray<T>[] |
11841206
| TResult1 | 0 | TResult1 \| PromiseLike<TResult1> |

0 commit comments

Comments
 (0)