mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
aggregate the tests in library-tests/TypeScript/Types into a single .ql file
This commit is contained in:
@@ -1 +0,0 @@
|
||||
| boolean |
|
||||
@@ -1,5 +0,0 @@
|
||||
import javascript
|
||||
|
||||
// Ensure `true | false` and `false | true` are not distinct boolean types.
|
||||
from BooleanType t
|
||||
select t
|
||||
@@ -1,147 +0,0 @@
|
||||
| boolean-type.ts:1:13:1:17 | dummy | typeof library-tests/TypeScript/Types/dummy.ts |
|
||||
| boolean-type.ts:1:24:1:32 | "./dummy" | any |
|
||||
| boolean-type.ts:3:5:3:9 | true1 | true |
|
||||
| boolean-type.ts:4:5:4:9 | true2 | true |
|
||||
| boolean-type.ts:6:5:6:10 | false1 | false |
|
||||
| boolean-type.ts:7:5:7:10 | false2 | false |
|
||||
| boolean-type.ts:9:5:9:12 | boolean1 | boolean |
|
||||
| boolean-type.ts:10:5:10:12 | boolean2 | boolean |
|
||||
| boolean-type.ts:11:5:11:12 | boolean3 | boolean |
|
||||
| boolean-type.ts:13:5:13:12 | boolean4 | boolean |
|
||||
| boolean-type.ts:14:5:14:12 | boolean5 | boolean |
|
||||
| boolean-type.ts:15:5:15:12 | boolean6 | boolean |
|
||||
| dummy.ts:2:12:2:12 | x | number |
|
||||
| dummy.ts:2:16:2:16 | 5 | 5 |
|
||||
| tst.ts:1:13:1:17 | dummy | typeof library-tests/TypeScript/Types/dummy.ts |
|
||||
| tst.ts:1:24:1:32 | "./dummy" | any |
|
||||
| tst.ts:3:5:3:10 | numVar | number |
|
||||
| tst.ts:5:5:5:8 | num1 | number |
|
||||
| tst.ts:5:12:5:17 | numVar | number |
|
||||
| tst.ts:6:5:6:8 | num2 | number |
|
||||
| tst.ts:6:12:6:12 | 5 | 5 |
|
||||
| tst.ts:7:5:7:8 | num3 | number |
|
||||
| tst.ts:7:12:7:15 | num1 | number |
|
||||
| tst.ts:7:12:7:22 | num1 + num2 | number |
|
||||
| tst.ts:7:19:7:22 | num2 | number |
|
||||
| tst.ts:9:5:9:10 | strVar | string |
|
||||
| tst.ts:10:5:10:9 | hello | string |
|
||||
| tst.ts:10:13:10:19 | "hello" | "hello" |
|
||||
| tst.ts:11:5:11:9 | world | string |
|
||||
| tst.ts:11:13:11:19 | "world" | "world" |
|
||||
| tst.ts:12:5:12:7 | msg | string |
|
||||
| tst.ts:12:11:12:15 | hello | string |
|
||||
| tst.ts:12:11:12:21 | hello + " " | string |
|
||||
| tst.ts:12:11:12:29 | hello + " " + world | string |
|
||||
| tst.ts:12:19:12:21 | " " | " " |
|
||||
| tst.ts:12:25:12:29 | world | string |
|
||||
| tst.ts:14:10:14:15 | concat | (x: string, y: string) => string |
|
||||
| tst.ts:14:17:14:17 | x | string |
|
||||
| tst.ts:14:28:14:28 | y | string |
|
||||
| tst.ts:14:56:14:56 | x | string |
|
||||
| tst.ts:14:56:14:60 | x + y | string |
|
||||
| tst.ts:14:60:14:60 | y | string |
|
||||
| tst.ts:16:10:16:12 | add | (x: number, y: number) => number |
|
||||
| tst.ts:16:14:16:14 | x | number |
|
||||
| tst.ts:16:25:16:25 | y | number |
|
||||
| tst.ts:16:53:16:53 | x | number |
|
||||
| tst.ts:16:53:16:57 | x + y | number |
|
||||
| tst.ts:16:57:16:57 | y | number |
|
||||
| tst.ts:18:10:18:16 | untyped | (x: any, y: any) => any |
|
||||
| tst.ts:18:18:18:18 | x | any |
|
||||
| tst.ts:18:21:18:21 | y | any |
|
||||
| tst.ts:18:33:18:33 | x | any |
|
||||
| tst.ts:18:33:18:37 | x + y | any |
|
||||
| tst.ts:18:37:18:37 | y | any |
|
||||
| tst.ts:20:10:20:21 | partialTyped | (x: any, y: string) => string |
|
||||
| tst.ts:20:23:20:23 | x | any |
|
||||
| tst.ts:20:26:20:26 | y | string |
|
||||
| tst.ts:20:46:20:46 | x | any |
|
||||
| tst.ts:20:46:20:50 | x + y | string |
|
||||
| tst.ts:20:50:20:50 | y | string |
|
||||
| tst.ts:22:10:22:20 | numFromLoop | number |
|
||||
| tst.ts:22:25:22:30 | [1, 2] | number[] |
|
||||
| tst.ts:22:26:22:26 | 1 | 1 |
|
||||
| tst.ts:22:29:22:29 | 2 | 2 |
|
||||
| tst.ts:24:5:24:9 | array | number[] |
|
||||
| tst.ts:26:5:26:12 | voidType | () => void |
|
||||
| tst.ts:26:15:26:24 | () => void | () => void |
|
||||
| tst.ts:27:5:27:17 | undefinedType | undefined |
|
||||
| tst.ts:28:5:28:12 | nullType | null |
|
||||
| tst.ts:29:5:29:13 | neverType | () => never |
|
||||
| tst.ts:29:16:29:26 | () => never | () => never |
|
||||
| tst.ts:30:5:30:14 | symbolType | symbol |
|
||||
| tst.ts:31:7:31:22 | uniqueSymbolType | typeof uniqueSymbolType |
|
||||
| tst.ts:32:5:32:14 | objectType | object |
|
||||
| tst.ts:33:5:33:16 | intersection | string & { x: string; } |
|
||||
| tst.ts:33:29:33:29 | x | string |
|
||||
| tst.ts:34:5:34:9 | tuple | [number, string] |
|
||||
| tst.ts:36:5:36:28 | tupleWi ... Element | [number, string, number?] |
|
||||
| tst.ts:37:5:37:14 | emptyTuple | [] |
|
||||
| tst.ts:38:5:38:24 | tupleWithRestElement | [number, ...string[]] |
|
||||
| tst.ts:39:5:39:36 | tupleWi ... lements | [number, string?, ...number[]] |
|
||||
| tst.ts:40:5:40:15 | unknownType | unknown |
|
||||
| tst.ts:42:5:42:21 | constArrayLiteral | readonly [1, 2] |
|
||||
| tst.ts:42:25:42:30 | [1, 2] | readonly [1, 2] |
|
||||
| tst.ts:42:25:42:39 | [1, 2] as const | readonly [1, 2] |
|
||||
| tst.ts:42:26:42:26 | 1 | 1 |
|
||||
| tst.ts:42:29:42:29 | 2 | 2 |
|
||||
| tst.ts:43:5:43:22 | constObjectLiteral | { readonly foo: "foo"; } |
|
||||
| tst.ts:43:26:43:39 | { foo: "foo" } | { readonly foo: "foo"; } |
|
||||
| tst.ts:43:26:43:48 | { foo: ... s const | { readonly foo: "foo"; } |
|
||||
| tst.ts:43:28:43:30 | foo | "foo" |
|
||||
| tst.ts:43:33:43:37 | "foo" | "foo" |
|
||||
| tst.ts:47:8:47:8 | e | unknown |
|
||||
| tst.ts:48:7:48:14 | typeof e | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
|
||||
| tst.ts:48:7:48:27 | typeof ... string" | boolean |
|
||||
| tst.ts:48:14:48:14 | e | unknown |
|
||||
| tst.ts:48:20:48:27 | "string" | "string" |
|
||||
| tst.ts:49:11:49:11 | b | string |
|
||||
| tst.ts:49:24:49:24 | e | string |
|
||||
| type_alias.ts:3:5:3:5 | b | boolean |
|
||||
| type_alias.ts:7:5:7:5 | c | ValueOrArray<number> |
|
||||
| type_alias.ts:14:9:14:32 | [proper ... ]: Json | any |
|
||||
| type_alias.ts:14:10:14:17 | property | string |
|
||||
| type_alias.ts:17:5:17:8 | json | Json |
|
||||
| type_alias.ts:21:18:21:35 | [key: string]: any | any |
|
||||
| type_alias.ts:21:19:21:21 | key | string |
|
||||
| type_alias.ts:23:7:23:12 | myNode | VirtualNode |
|
||||
| type_alias.ts:24:5:27:5 | ["div", ... ]\\n ] | VirtualNode |
|
||||
| type_alias.ts:24:6:24:10 | "div" | "div" |
|
||||
| type_alias.ts:24:13:24:28 | { id: "parent" } | string \| { [key: string]: any; } |
|
||||
| type_alias.ts:24:15:24:16 | id | string |
|
||||
| type_alias.ts:24:19:24:26 | "parent" | "parent" |
|
||||
| type_alias.ts:25:9:25:61 | ["div", ... child"] | VirtualNode |
|
||||
| type_alias.ts:25:10:25:14 | "div" | "div" |
|
||||
| type_alias.ts:25:17:25:37 | { id: " ... hild" } | string \| { [key: string]: any; } |
|
||||
| type_alias.ts:25:19:25:20 | id | string |
|
||||
| type_alias.ts:25:23:25:35 | "first-child" | "first-child" |
|
||||
| type_alias.ts:25:40:25:60 | "I'm th ... child" | "I'm the first child" |
|
||||
| type_alias.ts:26:9:26:63 | ["div", ... child"] | VirtualNode |
|
||||
| type_alias.ts:26:10:26:14 | "div" | "div" |
|
||||
| type_alias.ts:26:17:26:38 | { id: " ... hild" } | string \| { [key: string]: any; } |
|
||||
| type_alias.ts:26:19:26:20 | id | string |
|
||||
| type_alias.ts:26:23:26:36 | "second-child" | "second-child" |
|
||||
| type_alias.ts:26:41:26:62 | "I'm th ... child" | "I'm the second child" |
|
||||
| type_definition_objects.ts:1:13:1:17 | dummy | typeof library-tests/TypeScript/Types/dummy.ts |
|
||||
| type_definition_objects.ts:1:24:1:32 | "./dummy" | any |
|
||||
| type_definition_objects.ts:3:14:3:14 | C | C |
|
||||
| type_definition_objects.ts:4:5:4:12 | classObj | typeof C in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:4:16:4:16 | C | typeof C in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:6:13:6:13 | E | E |
|
||||
| type_definition_objects.ts:7:5:7:11 | enumObj | typeof E in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:7:15:7:15 | E | typeof E in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:9:18:9:18 | N | typeof N in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:10:5:10:16 | namespaceObj | typeof N in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:10:20:10:20 | N | typeof N in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definitions.ts:1:13:1:17 | dummy | typeof library-tests/TypeScript/Types/dummy.ts |
|
||||
| type_definitions.ts:1:24:1:32 | "./dummy" | any |
|
||||
| type_definitions.ts:4:3:4:3 | x | S |
|
||||
| type_definitions.ts:6:5:6:5 | i | I<number> |
|
||||
| type_definitions.ts:8:7:8:7 | C | C<T> |
|
||||
| type_definitions.ts:9:3:9:3 | x | T |
|
||||
| type_definitions.ts:11:5:11:5 | c | C<number> |
|
||||
| type_definitions.ts:13:6:13:10 | Color | Color |
|
||||
| type_definitions.ts:16:5:16:9 | color | Color |
|
||||
| type_definitions.ts:18:6:18:22 | EnumWithOneMember | EnumWithOneMember |
|
||||
| type_definitions.ts:19:5:19:5 | e | EnumWithOneMember |
|
||||
| type_definitions.ts:22:5:22:23 | aliasForNumberArray | Alias<number> |
|
||||
@@ -1,4 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from Expr expr
|
||||
select expr, expr.getType()
|
||||
@@ -1,11 +0,0 @@
|
||||
| type_alias.ts:1:1:1:17 | type B = boolean; | boolean |
|
||||
| type_alias.ts:5:1:5:50 | type Va ... ay<T>>; | ValueOrArray<T> |
|
||||
| type_alias.ts:9:1:15:13 | type Js ... Json[]; | Json |
|
||||
| type_alias.ts:19:1:21:57 | type Vi ... ode[]]; | VirtualNode |
|
||||
| type_definition_objects.ts:3:8:3:17 | class C {} | C |
|
||||
| type_definition_objects.ts:6:8:6:16 | enum E {} | E |
|
||||
| type_definitions.ts:3:1:5:1 | interfa ... x: S;\\n} | I<S> |
|
||||
| type_definitions.ts:8:1:10:1 | class C ... x: T\\n} | C<T> |
|
||||
| type_definitions.ts:13:1:15:1 | enum Co ... blue\\n} | Color |
|
||||
| type_definitions.ts:18:1:18:33 | enum En ... ember } | EnumWithOneMember |
|
||||
| type_definitions.ts:21:1:21:20 | type Alias<T> = T[]; | Alias<T> |
|
||||
@@ -1,4 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from TypeDefinition def
|
||||
select def, def.getType()
|
||||
@@ -1,130 +0,0 @@
|
||||
| boolean-type.ts:3:12:3:15 | true | true |
|
||||
| boolean-type.ts:4:12:4:15 | true | true |
|
||||
| boolean-type.ts:4:12:4:22 | true \| true | true |
|
||||
| boolean-type.ts:4:19:4:22 | true | true |
|
||||
| boolean-type.ts:6:13:6:17 | false | false |
|
||||
| boolean-type.ts:7:13:7:17 | false | false |
|
||||
| boolean-type.ts:7:13:7:25 | false \| false | false |
|
||||
| boolean-type.ts:7:21:7:25 | false | false |
|
||||
| boolean-type.ts:9:15:9:21 | boolean | boolean |
|
||||
| boolean-type.ts:10:15:10:18 | true | true |
|
||||
| boolean-type.ts:10:15:10:26 | true \| false | boolean |
|
||||
| boolean-type.ts:10:22:10:26 | false | false |
|
||||
| boolean-type.ts:11:15:11:19 | false | false |
|
||||
| boolean-type.ts:11:15:11:26 | false \| true | boolean |
|
||||
| boolean-type.ts:11:23:11:26 | true | true |
|
||||
| boolean-type.ts:13:15:13:21 | boolean | boolean |
|
||||
| boolean-type.ts:13:15:13:31 | boolean \| boolean | boolean |
|
||||
| boolean-type.ts:13:25:13:31 | boolean | boolean |
|
||||
| boolean-type.ts:14:15:14:21 | boolean | boolean |
|
||||
| boolean-type.ts:14:15:14:28 | boolean \| true | boolean |
|
||||
| boolean-type.ts:14:25:14:28 | true | true |
|
||||
| boolean-type.ts:15:15:15:19 | false | false |
|
||||
| boolean-type.ts:15:15:15:29 | false \| boolean | boolean |
|
||||
| boolean-type.ts:15:23:15:29 | boolean | boolean |
|
||||
| tst.ts:3:13:3:18 | number | number |
|
||||
| tst.ts:9:13:9:18 | string | string |
|
||||
| tst.ts:14:20:14:25 | string | string |
|
||||
| tst.ts:14:31:14:36 | string | string |
|
||||
| tst.ts:14:40:14:45 | string | string |
|
||||
| tst.ts:16:17:16:22 | number | number |
|
||||
| tst.ts:16:28:16:33 | number | number |
|
||||
| tst.ts:16:37:16:42 | number | number |
|
||||
| tst.ts:20:29:20:34 | string | string |
|
||||
| tst.ts:24:12:24:17 | number | number |
|
||||
| tst.ts:24:12:24:19 | number[] | number[] |
|
||||
| tst.ts:26:15:26:24 | () => void | () => void |
|
||||
| tst.ts:26:21:26:24 | void | void |
|
||||
| tst.ts:27:20:27:28 | undefined | undefined |
|
||||
| tst.ts:28:15:28:18 | null | null |
|
||||
| tst.ts:29:16:29:26 | () => never | () => never |
|
||||
| tst.ts:29:22:29:26 | never | never |
|
||||
| tst.ts:30:17:30:22 | symbol | symbol |
|
||||
| tst.ts:31:25:31:37 | unique symbol | typeof uniqueSymbolType |
|
||||
| tst.ts:32:17:32:22 | object | object |
|
||||
| tst.ts:33:19:33:24 | string | string |
|
||||
| tst.ts:33:19:33:38 | string & {x: string} | string & { x: string; } |
|
||||
| tst.ts:33:28:33:38 | {x: string} | { x: string; } |
|
||||
| tst.ts:33:32:33:37 | string | string |
|
||||
| tst.ts:34:12:34:27 | [number, string] | [number, string] |
|
||||
| tst.ts:34:13:34:18 | number | number |
|
||||
| tst.ts:34:21:34:26 | string | string |
|
||||
| tst.ts:36:31:36:55 | [number ... umber?] | [number, string, number?] |
|
||||
| tst.ts:36:32:36:37 | number | number |
|
||||
| tst.ts:36:40:36:45 | string | string |
|
||||
| tst.ts:36:48:36:53 | number | number |
|
||||
| tst.ts:36:48:36:54 | number? | number |
|
||||
| tst.ts:37:17:37:18 | [] | [] |
|
||||
| tst.ts:38:27:38:47 | [number ... ring[]] | [number, ...string[]] |
|
||||
| tst.ts:38:28:38:33 | number | number |
|
||||
| tst.ts:38:36:38:46 | ...string[] | string |
|
||||
| tst.ts:38:39:38:44 | string | string |
|
||||
| tst.ts:38:39:38:46 | string[] | string[] |
|
||||
| tst.ts:39:39:39:68 | [number ... mber[]] | [number, string?, ...number[]] |
|
||||
| tst.ts:39:40:39:45 | number | number |
|
||||
| tst.ts:39:48:39:53 | string | string |
|
||||
| tst.ts:39:48:39:54 | string? | string |
|
||||
| tst.ts:39:57:39:67 | ...number[] | number |
|
||||
| tst.ts:39:60:39:65 | number | number |
|
||||
| tst.ts:39:60:39:67 | number[] | number[] |
|
||||
| tst.ts:40:18:40:24 | unknown | unknown |
|
||||
| tst.ts:49:15:49:20 | string | string |
|
||||
| type_alias.ts:1:6:1:6 | B | boolean |
|
||||
| type_alias.ts:1:10:1:16 | boolean | boolean |
|
||||
| type_alias.ts:3:8:3:8 | B | boolean |
|
||||
| type_alias.ts:5:6:5:17 | ValueOrArray | ValueOrArray<T> |
|
||||
| type_alias.ts:5:19:5:19 | T | T |
|
||||
| type_alias.ts:5:24:5:24 | T | T |
|
||||
| type_alias.ts:5:24:5:49 | T \| Arr ... ray<T>> | T \| ValueOrArray<T>[] |
|
||||
| type_alias.ts:5:28:5:32 | Array | T[] |
|
||||
| type_alias.ts:5:28:5:49 | Array<V ... ray<T>> | ValueOrArray<T>[] |
|
||||
| type_alias.ts:5:34:5:45 | ValueOrArray | ValueOrArray<T> |
|
||||
| type_alias.ts:5:34:5:48 | ValueOrArray<T> | ValueOrArray<T> |
|
||||
| type_alias.ts:5:47:5:47 | T | T |
|
||||
| type_alias.ts:7:8:7:19 | ValueOrArray | ValueOrArray<T> |
|
||||
| type_alias.ts:7:8:7:27 | ValueOrArray<number> | ValueOrArray<number> |
|
||||
| type_alias.ts:7:21:7:26 | number | number |
|
||||
| type_alias.ts:9:6:9:9 | Json | Json |
|
||||
| type_alias.ts:10:5:15:12 | \| strin ... Json[] | string \| number \| boolean \| { [property: string... |
|
||||
| type_alias.ts:10:7:10:12 | string | string |
|
||||
| type_alias.ts:11:7:11:12 | number | number |
|
||||
| type_alias.ts:12:7:12:13 | boolean | boolean |
|
||||
| type_alias.ts:13:7:13:10 | null | null |
|
||||
| type_alias.ts:14:7:14:34 | { [prop ... Json } | { [property: string]: Json; } |
|
||||
| type_alias.ts:14:20:14:25 | string | string |
|
||||
| type_alias.ts:14:29:14:32 | Json | Json |
|
||||
| type_alias.ts:15:7:15:10 | Json | Json |
|
||||
| type_alias.ts:15:7:15:12 | Json[] | Json[] |
|
||||
| type_alias.ts:17:11:17:14 | Json | Json |
|
||||
| type_alias.ts:19:6:19:16 | VirtualNode | VirtualNode |
|
||||
| type_alias.ts:20:5:21:56 | \| strin ... Node[]] | string \| [string, { [key: string]: any; }, ...V... |
|
||||
| type_alias.ts:20:7:20:12 | string | string |
|
||||
| type_alias.ts:21:7:21:56 | [string ... Node[]] | [string, { [key: string]: any; }, ...VirtualNod... |
|
||||
| type_alias.ts:21:8:21:13 | string | string |
|
||||
| type_alias.ts:21:16:21:37 | { [key: ... : any } | { [key: string]: any; } |
|
||||
| type_alias.ts:21:24:21:29 | string | string |
|
||||
| type_alias.ts:21:33:21:35 | any | any |
|
||||
| type_alias.ts:21:40:21:55 | ...VirtualNode[] | VirtualNode |
|
||||
| type_alias.ts:21:43:21:53 | VirtualNode | VirtualNode |
|
||||
| type_alias.ts:21:43:21:55 | VirtualNode[] | VirtualNode[] |
|
||||
| type_alias.ts:23:15:23:25 | VirtualNode | VirtualNode |
|
||||
| type_definitions.ts:3:11:3:11 | I | I<S> |
|
||||
| type_definitions.ts:3:13:3:13 | S | S |
|
||||
| type_definitions.ts:4:6:4:6 | S | S |
|
||||
| type_definitions.ts:6:8:6:8 | I | I<S> |
|
||||
| type_definitions.ts:6:8:6:16 | I<number> | I<number> |
|
||||
| type_definitions.ts:6:10:6:15 | number | number |
|
||||
| type_definitions.ts:8:9:8:9 | T | T |
|
||||
| type_definitions.ts:9:6:9:6 | T | T |
|
||||
| type_definitions.ts:11:8:11:8 | C | C<T> |
|
||||
| type_definitions.ts:11:8:11:16 | C<number> | C<number> |
|
||||
| type_definitions.ts:11:10:11:15 | number | number |
|
||||
| type_definitions.ts:16:12:16:16 | Color | Color |
|
||||
| type_definitions.ts:19:8:19:24 | EnumWithOneMember | EnumWithOneMember |
|
||||
| type_definitions.ts:21:6:21:10 | Alias | Alias<T> |
|
||||
| type_definitions.ts:21:12:21:12 | T | T |
|
||||
| type_definitions.ts:21:17:21:17 | T | T |
|
||||
| type_definitions.ts:21:17:21:19 | T[] | T[] |
|
||||
| type_definitions.ts:22:26:22:30 | Alias | Alias<T> |
|
||||
| type_definitions.ts:22:26:22:38 | Alias<number> | Alias<number> |
|
||||
| type_definitions.ts:22:32:22:37 | number | number |
|
||||
@@ -1,4 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from TypeExpr e
|
||||
select e, e.getType()
|
||||
@@ -1,5 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from Type typ
|
||||
where not exists(typ.toString())
|
||||
select "Missing toString for " + typ.getAQlClass()
|
||||
@@ -1,17 +0,0 @@
|
||||
| Alias<T> | type_definitions.ts:21:1:21:20 | type Alias<T> = T[]; |
|
||||
| Alias<number> | type_definitions.ts:21:1:21:20 | type Alias<T> = T[]; |
|
||||
| C | type_definition_objects.ts:3:8:3:17 | class C {} |
|
||||
| C<T> | type_definitions.ts:8:1:10:1 | class C ... x: T\\n} |
|
||||
| C<number> | type_definitions.ts:8:1:10:1 | class C ... x: T\\n} |
|
||||
| Color | type_definitions.ts:13:1:15:1 | enum Co ... blue\\n} |
|
||||
| Color.blue | type_definitions.ts:14:15:14:18 | blue |
|
||||
| Color.green | type_definitions.ts:14:8:14:12 | green |
|
||||
| Color.red | type_definitions.ts:14:3:14:5 | red |
|
||||
| E | type_definition_objects.ts:6:8:6:16 | enum E {} |
|
||||
| EnumWithOneMember | type_definitions.ts:18:26:18:31 | member |
|
||||
| I<S> | type_definitions.ts:3:1:5:1 | interfa ... x: S;\\n} |
|
||||
| I<number> | type_definitions.ts:3:1:5:1 | interfa ... x: S;\\n} |
|
||||
| Json | type_alias.ts:9:1:15:13 | type Js ... Json[]; |
|
||||
| ValueOrArray<T> | type_alias.ts:5:1:5:50 | type Va ... ay<T>>; |
|
||||
| ValueOrArray<number> | type_alias.ts:5:1:5:50 | type Va ... ay<T>>; |
|
||||
| VirtualNode | type_alias.ts:19:1:21:57 | type Vi ... ode[]]; |
|
||||
@@ -1,4 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from TypeReference ref
|
||||
select ref, ref.getADefinition()
|
||||
@@ -1,16 +0,0 @@
|
||||
| tst.ts:34:5:34:9 | tuple | [number, string] | 0 | number | 2 | no-rest |
|
||||
| tst.ts:34:5:34:9 | tuple | [number, string] | 1 | string | 2 | no-rest |
|
||||
| tst.ts:36:5:36:28 | tupleWi ... Element | [number, string, number?] | 0 | number | 2 | no-rest |
|
||||
| tst.ts:36:5:36:28 | tupleWi ... Element | [number, string, number?] | 1 | string | 2 | no-rest |
|
||||
| tst.ts:36:5:36:28 | tupleWi ... Element | [number, string, number?] | 2 | number | 2 | no-rest |
|
||||
| tst.ts:38:5:38:24 | tupleWithRestElement | [number, ...string[]] | 0 | number | 1 | string |
|
||||
| tst.ts:38:5:38:24 | tupleWithRestElement | [number, ...string[]] | 1 | string | 1 | string |
|
||||
| tst.ts:39:5:39:36 | tupleWi ... lements | [number, string?, ...number[]] | 0 | number | 1 | number |
|
||||
| tst.ts:39:5:39:36 | tupleWi ... lements | [number, string?, ...number[]] | 1 | string | 1 | number |
|
||||
| tst.ts:39:5:39:36 | tupleWi ... lements | [number, string?, ...number[]] | 2 | number | 1 | number |
|
||||
| tst.ts:42:5:42:21 | constArrayLiteral | readonly [1, 2] | 0 | 1 | 2 | no-rest |
|
||||
| tst.ts:42:5:42:21 | constArrayLiteral | readonly [1, 2] | 1 | 2 | 2 | no-rest |
|
||||
| tst.ts:42:25:42:30 | [1, 2] | readonly [1, 2] | 0 | 1 | 2 | no-rest |
|
||||
| tst.ts:42:25:42:30 | [1, 2] | readonly [1, 2] | 1 | 2 | 2 | no-rest |
|
||||
| tst.ts:42:25:42:39 | [1, 2] as const | readonly [1, 2] | 0 | 1 | 2 | no-rest |
|
||||
| tst.ts:42:25:42:39 | [1, 2] as const | readonly [1, 2] | 1 | 2 | 2 | no-rest |
|
||||
@@ -1,11 +0,0 @@
|
||||
import javascript
|
||||
|
||||
string getRest(TupleType tuple) {
|
||||
if tuple.hasRestElement()
|
||||
then result = tuple.getRestElementType().toString()
|
||||
else result = "no-rest"
|
||||
}
|
||||
|
||||
from Expr e, TupleType tuple, int n
|
||||
where e.getType() = tuple
|
||||
select e, tuple, n, tuple.getElementType(n), tuple.getMinimumLength(), getRest(tuple)
|
||||
@@ -1,3 +0,0 @@
|
||||
| tst.ts:40:5:40:15 | unknownType | unknown |
|
||||
| tst.ts:47:8:47:8 | e | unknown |
|
||||
| tst.ts:48:14:48:14 | e | unknown |
|
||||
@@ -1,5 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from Expr e
|
||||
where e.getType() instanceof UnknownType
|
||||
select e, e.getType()
|
||||
333
javascript/ql/test/library-tests/TypeScript/Types/tests.expected
Normal file
333
javascript/ql/test/library-tests/TypeScript/Types/tests.expected
Normal file
@@ -0,0 +1,333 @@
|
||||
booleans
|
||||
| boolean |
|
||||
getExprType
|
||||
| boolean-type.ts:1:13:1:17 | dummy | typeof library-tests/TypeScript/Types/dummy.ts |
|
||||
| boolean-type.ts:1:24:1:32 | "./dummy" | any |
|
||||
| boolean-type.ts:3:5:3:9 | true1 | true |
|
||||
| boolean-type.ts:4:5:4:9 | true2 | true |
|
||||
| boolean-type.ts:6:5:6:10 | false1 | false |
|
||||
| boolean-type.ts:7:5:7:10 | false2 | false |
|
||||
| boolean-type.ts:9:5:9:12 | boolean1 | boolean |
|
||||
| boolean-type.ts:10:5:10:12 | boolean2 | boolean |
|
||||
| boolean-type.ts:11:5:11:12 | boolean3 | boolean |
|
||||
| boolean-type.ts:13:5:13:12 | boolean4 | boolean |
|
||||
| boolean-type.ts:14:5:14:12 | boolean5 | boolean |
|
||||
| boolean-type.ts:15:5:15:12 | boolean6 | boolean |
|
||||
| dummy.ts:2:12:2:12 | x | number |
|
||||
| dummy.ts:2:16:2:16 | 5 | 5 |
|
||||
| tst.ts:1:13:1:17 | dummy | typeof library-tests/TypeScript/Types/dummy.ts |
|
||||
| tst.ts:1:24:1:32 | "./dummy" | any |
|
||||
| tst.ts:3:5:3:10 | numVar | number |
|
||||
| tst.ts:5:5:5:8 | num1 | number |
|
||||
| tst.ts:5:12:5:17 | numVar | number |
|
||||
| tst.ts:6:5:6:8 | num2 | number |
|
||||
| tst.ts:6:12:6:12 | 5 | 5 |
|
||||
| tst.ts:7:5:7:8 | num3 | number |
|
||||
| tst.ts:7:12:7:15 | num1 | number |
|
||||
| tst.ts:7:12:7:22 | num1 + num2 | number |
|
||||
| tst.ts:7:19:7:22 | num2 | number |
|
||||
| tst.ts:9:5:9:10 | strVar | string |
|
||||
| tst.ts:10:5:10:9 | hello | string |
|
||||
| tst.ts:10:13:10:19 | "hello" | "hello" |
|
||||
| tst.ts:11:5:11:9 | world | string |
|
||||
| tst.ts:11:13:11:19 | "world" | "world" |
|
||||
| tst.ts:12:5:12:7 | msg | string |
|
||||
| tst.ts:12:11:12:15 | hello | string |
|
||||
| tst.ts:12:11:12:21 | hello + " " | string |
|
||||
| tst.ts:12:11:12:29 | hello + " " + world | string |
|
||||
| tst.ts:12:19:12:21 | " " | " " |
|
||||
| tst.ts:12:25:12:29 | world | string |
|
||||
| tst.ts:14:10:14:15 | concat | (x: string, y: string) => string |
|
||||
| tst.ts:14:17:14:17 | x | string |
|
||||
| tst.ts:14:28:14:28 | y | string |
|
||||
| tst.ts:14:56:14:56 | x | string |
|
||||
| tst.ts:14:56:14:60 | x + y | string |
|
||||
| tst.ts:14:60:14:60 | y | string |
|
||||
| tst.ts:16:10:16:12 | add | (x: number, y: number) => number |
|
||||
| tst.ts:16:14:16:14 | x | number |
|
||||
| tst.ts:16:25:16:25 | y | number |
|
||||
| tst.ts:16:53:16:53 | x | number |
|
||||
| tst.ts:16:53:16:57 | x + y | number |
|
||||
| tst.ts:16:57:16:57 | y | number |
|
||||
| tst.ts:18:10:18:16 | untyped | (x: any, y: any) => any |
|
||||
| tst.ts:18:18:18:18 | x | any |
|
||||
| tst.ts:18:21:18:21 | y | any |
|
||||
| tst.ts:18:33:18:33 | x | any |
|
||||
| tst.ts:18:33:18:37 | x + y | any |
|
||||
| tst.ts:18:37:18:37 | y | any |
|
||||
| tst.ts:20:10:20:21 | partialTyped | (x: any, y: string) => string |
|
||||
| tst.ts:20:23:20:23 | x | any |
|
||||
| tst.ts:20:26:20:26 | y | string |
|
||||
| tst.ts:20:46:20:46 | x | any |
|
||||
| tst.ts:20:46:20:50 | x + y | string |
|
||||
| tst.ts:20:50:20:50 | y | string |
|
||||
| tst.ts:22:10:22:20 | numFromLoop | number |
|
||||
| tst.ts:22:25:22:30 | [1, 2] | number[] |
|
||||
| tst.ts:22:26:22:26 | 1 | 1 |
|
||||
| tst.ts:22:29:22:29 | 2 | 2 |
|
||||
| tst.ts:24:5:24:9 | array | number[] |
|
||||
| tst.ts:26:5:26:12 | voidType | () => void |
|
||||
| tst.ts:26:15:26:24 | () => void | () => void |
|
||||
| tst.ts:27:5:27:17 | undefinedType | undefined |
|
||||
| tst.ts:28:5:28:12 | nullType | null |
|
||||
| tst.ts:29:5:29:13 | neverType | () => never |
|
||||
| tst.ts:29:16:29:26 | () => never | () => never |
|
||||
| tst.ts:30:5:30:14 | symbolType | symbol |
|
||||
| tst.ts:31:7:31:22 | uniqueSymbolType | typeof uniqueSymbolType |
|
||||
| tst.ts:32:5:32:14 | objectType | object |
|
||||
| tst.ts:33:5:33:16 | intersection | string & { x: string; } |
|
||||
| tst.ts:33:29:33:29 | x | string |
|
||||
| tst.ts:34:5:34:9 | tuple | [number, string] |
|
||||
| tst.ts:36:5:36:28 | tupleWi ... Element | [number, string, number?] |
|
||||
| tst.ts:37:5:37:14 | emptyTuple | [] |
|
||||
| tst.ts:38:5:38:24 | tupleWithRestElement | [number, ...string[]] |
|
||||
| tst.ts:39:5:39:36 | tupleWi ... lements | [number, string?, ...number[]] |
|
||||
| tst.ts:40:5:40:15 | unknownType | unknown |
|
||||
| tst.ts:42:5:42:21 | constArrayLiteral | readonly [1, 2] |
|
||||
| tst.ts:42:25:42:30 | [1, 2] | readonly [1, 2] |
|
||||
| tst.ts:42:25:42:39 | [1, 2] as const | readonly [1, 2] |
|
||||
| tst.ts:42:26:42:26 | 1 | 1 |
|
||||
| tst.ts:42:29:42:29 | 2 | 2 |
|
||||
| tst.ts:43:5:43:22 | constObjectLiteral | { readonly foo: "foo"; } |
|
||||
| tst.ts:43:26:43:39 | { foo: "foo" } | { readonly foo: "foo"; } |
|
||||
| tst.ts:43:26:43:48 | { foo: ... s const | { readonly foo: "foo"; } |
|
||||
| tst.ts:43:28:43:30 | foo | "foo" |
|
||||
| tst.ts:43:33:43:37 | "foo" | "foo" |
|
||||
| tst.ts:47:8:47:8 | e | unknown |
|
||||
| tst.ts:48:7:48:14 | typeof e | "string" \| "number" \| "bigint" \| "boolean" \| "s... |
|
||||
| tst.ts:48:7:48:27 | typeof ... string" | boolean |
|
||||
| tst.ts:48:14:48:14 | e | unknown |
|
||||
| tst.ts:48:20:48:27 | "string" | "string" |
|
||||
| tst.ts:49:11:49:11 | b | string |
|
||||
| tst.ts:49:24:49:24 | e | string |
|
||||
| type_alias.ts:3:5:3:5 | b | boolean |
|
||||
| type_alias.ts:7:5:7:5 | c | ValueOrArray<number> |
|
||||
| type_alias.ts:14:9:14:32 | [proper ... ]: Json | any |
|
||||
| type_alias.ts:14:10:14:17 | property | string |
|
||||
| type_alias.ts:17:5:17:8 | json | Json |
|
||||
| type_alias.ts:21:18:21:35 | [key: string]: any | any |
|
||||
| type_alias.ts:21:19:21:21 | key | string |
|
||||
| type_alias.ts:23:7:23:12 | myNode | VirtualNode |
|
||||
| type_alias.ts:24:5:27:5 | ["div", ... ]\\n ] | VirtualNode |
|
||||
| type_alias.ts:24:6:24:10 | "div" | "div" |
|
||||
| type_alias.ts:24:13:24:28 | { id: "parent" } | string \| { [key: string]: any; } |
|
||||
| type_alias.ts:24:15:24:16 | id | string |
|
||||
| type_alias.ts:24:19:24:26 | "parent" | "parent" |
|
||||
| type_alias.ts:25:9:25:61 | ["div", ... child"] | VirtualNode |
|
||||
| type_alias.ts:25:10:25:14 | "div" | "div" |
|
||||
| type_alias.ts:25:17:25:37 | { id: " ... hild" } | string \| { [key: string]: any; } |
|
||||
| type_alias.ts:25:19:25:20 | id | string |
|
||||
| type_alias.ts:25:23:25:35 | "first-child" | "first-child" |
|
||||
| type_alias.ts:25:40:25:60 | "I'm th ... child" | "I'm the first child" |
|
||||
| type_alias.ts:26:9:26:63 | ["div", ... child"] | VirtualNode |
|
||||
| type_alias.ts:26:10:26:14 | "div" | "div" |
|
||||
| type_alias.ts:26:17:26:38 | { id: " ... hild" } | string \| { [key: string]: any; } |
|
||||
| type_alias.ts:26:19:26:20 | id | string |
|
||||
| type_alias.ts:26:23:26:36 | "second-child" | "second-child" |
|
||||
| type_alias.ts:26:41:26:62 | "I'm th ... child" | "I'm the second child" |
|
||||
| type_definition_objects.ts:1:13:1:17 | dummy | typeof library-tests/TypeScript/Types/dummy.ts |
|
||||
| type_definition_objects.ts:1:24:1:32 | "./dummy" | any |
|
||||
| type_definition_objects.ts:3:14:3:14 | C | C |
|
||||
| type_definition_objects.ts:4:5:4:12 | classObj | typeof C in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:4:16:4:16 | C | typeof C in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:6:13:6:13 | E | E |
|
||||
| type_definition_objects.ts:7:5:7:11 | enumObj | typeof E in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:7:15:7:15 | E | typeof E in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:9:18:9:18 | N | typeof N in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:10:5:10:16 | namespaceObj | typeof N in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definition_objects.ts:10:20:10:20 | N | typeof N in library-tests/TypeScript/Types/type_definition_objects.ts |
|
||||
| type_definitions.ts:1:13:1:17 | dummy | typeof library-tests/TypeScript/Types/dummy.ts |
|
||||
| type_definitions.ts:1:24:1:32 | "./dummy" | any |
|
||||
| type_definitions.ts:4:3:4:3 | x | S |
|
||||
| type_definitions.ts:6:5:6:5 | i | I<number> |
|
||||
| type_definitions.ts:8:7:8:7 | C | C<T> |
|
||||
| type_definitions.ts:9:3:9:3 | x | T |
|
||||
| type_definitions.ts:11:5:11:5 | c | C<number> |
|
||||
| type_definitions.ts:13:6:13:10 | Color | Color |
|
||||
| type_definitions.ts:16:5:16:9 | color | Color |
|
||||
| type_definitions.ts:18:6:18:22 | EnumWithOneMember | EnumWithOneMember |
|
||||
| type_definitions.ts:19:5:19:5 | e | EnumWithOneMember |
|
||||
| type_definitions.ts:22:5:22:23 | aliasForNumberArray | Alias<number> |
|
||||
getTypeDefinitionType
|
||||
| type_alias.ts:1:1:1:17 | type B = boolean; | boolean |
|
||||
| type_alias.ts:5:1:5:50 | type Va ... ay<T>>; | ValueOrArray<T> |
|
||||
| type_alias.ts:9:1:15:13 | type Js ... Json[]; | Json |
|
||||
| type_alias.ts:19:1:21:57 | type Vi ... ode[]]; | VirtualNode |
|
||||
| type_definition_objects.ts:3:8:3:17 | class C {} | C |
|
||||
| type_definition_objects.ts:6:8:6:16 | enum E {} | E |
|
||||
| type_definitions.ts:3:1:5:1 | interfa ... x: S;\\n} | I<S> |
|
||||
| type_definitions.ts:8:1:10:1 | class C ... x: T\\n} | C<T> |
|
||||
| type_definitions.ts:13:1:15:1 | enum Co ... blue\\n} | Color |
|
||||
| type_definitions.ts:18:1:18:33 | enum En ... ember } | EnumWithOneMember |
|
||||
| type_definitions.ts:21:1:21:20 | type Alias<T> = T[]; | Alias<T> |
|
||||
getTypeExprType
|
||||
| boolean-type.ts:3:12:3:15 | true | true |
|
||||
| boolean-type.ts:4:12:4:15 | true | true |
|
||||
| boolean-type.ts:4:12:4:22 | true \| true | true |
|
||||
| boolean-type.ts:4:19:4:22 | true | true |
|
||||
| boolean-type.ts:6:13:6:17 | false | false |
|
||||
| boolean-type.ts:7:13:7:17 | false | false |
|
||||
| boolean-type.ts:7:13:7:25 | false \| false | false |
|
||||
| boolean-type.ts:7:21:7:25 | false | false |
|
||||
| boolean-type.ts:9:15:9:21 | boolean | boolean |
|
||||
| boolean-type.ts:10:15:10:18 | true | true |
|
||||
| boolean-type.ts:10:15:10:26 | true \| false | boolean |
|
||||
| boolean-type.ts:10:22:10:26 | false | false |
|
||||
| boolean-type.ts:11:15:11:19 | false | false |
|
||||
| boolean-type.ts:11:15:11:26 | false \| true | boolean |
|
||||
| boolean-type.ts:11:23:11:26 | true | true |
|
||||
| boolean-type.ts:13:15:13:21 | boolean | boolean |
|
||||
| boolean-type.ts:13:15:13:31 | boolean \| boolean | boolean |
|
||||
| boolean-type.ts:13:25:13:31 | boolean | boolean |
|
||||
| boolean-type.ts:14:15:14:21 | boolean | boolean |
|
||||
| boolean-type.ts:14:15:14:28 | boolean \| true | boolean |
|
||||
| boolean-type.ts:14:25:14:28 | true | true |
|
||||
| boolean-type.ts:15:15:15:19 | false | false |
|
||||
| boolean-type.ts:15:15:15:29 | false \| boolean | boolean |
|
||||
| boolean-type.ts:15:23:15:29 | boolean | boolean |
|
||||
| tst.ts:3:13:3:18 | number | number |
|
||||
| tst.ts:9:13:9:18 | string | string |
|
||||
| tst.ts:14:20:14:25 | string | string |
|
||||
| tst.ts:14:31:14:36 | string | string |
|
||||
| tst.ts:14:40:14:45 | string | string |
|
||||
| tst.ts:16:17:16:22 | number | number |
|
||||
| tst.ts:16:28:16:33 | number | number |
|
||||
| tst.ts:16:37:16:42 | number | number |
|
||||
| tst.ts:20:29:20:34 | string | string |
|
||||
| tst.ts:24:12:24:17 | number | number |
|
||||
| tst.ts:24:12:24:19 | number[] | number[] |
|
||||
| tst.ts:26:15:26:24 | () => void | () => void |
|
||||
| tst.ts:26:21:26:24 | void | void |
|
||||
| tst.ts:27:20:27:28 | undefined | undefined |
|
||||
| tst.ts:28:15:28:18 | null | null |
|
||||
| tst.ts:29:16:29:26 | () => never | () => never |
|
||||
| tst.ts:29:22:29:26 | never | never |
|
||||
| tst.ts:30:17:30:22 | symbol | symbol |
|
||||
| tst.ts:31:25:31:37 | unique symbol | typeof uniqueSymbolType |
|
||||
| tst.ts:32:17:32:22 | object | object |
|
||||
| tst.ts:33:19:33:24 | string | string |
|
||||
| tst.ts:33:19:33:38 | string & {x: string} | string & { x: string; } |
|
||||
| tst.ts:33:28:33:38 | {x: string} | { x: string; } |
|
||||
| tst.ts:33:32:33:37 | string | string |
|
||||
| tst.ts:34:12:34:27 | [number, string] | [number, string] |
|
||||
| tst.ts:34:13:34:18 | number | number |
|
||||
| tst.ts:34:21:34:26 | string | string |
|
||||
| tst.ts:36:31:36:55 | [number ... umber?] | [number, string, number?] |
|
||||
| tst.ts:36:32:36:37 | number | number |
|
||||
| tst.ts:36:40:36:45 | string | string |
|
||||
| tst.ts:36:48:36:53 | number | number |
|
||||
| tst.ts:36:48:36:54 | number? | number |
|
||||
| tst.ts:37:17:37:18 | [] | [] |
|
||||
| tst.ts:38:27:38:47 | [number ... ring[]] | [number, ...string[]] |
|
||||
| tst.ts:38:28:38:33 | number | number |
|
||||
| tst.ts:38:36:38:46 | ...string[] | string |
|
||||
| tst.ts:38:39:38:44 | string | string |
|
||||
| tst.ts:38:39:38:46 | string[] | string[] |
|
||||
| tst.ts:39:39:39:68 | [number ... mber[]] | [number, string?, ...number[]] |
|
||||
| tst.ts:39:40:39:45 | number | number |
|
||||
| tst.ts:39:48:39:53 | string | string |
|
||||
| tst.ts:39:48:39:54 | string? | string |
|
||||
| tst.ts:39:57:39:67 | ...number[] | number |
|
||||
| tst.ts:39:60:39:65 | number | number |
|
||||
| tst.ts:39:60:39:67 | number[] | number[] |
|
||||
| tst.ts:40:18:40:24 | unknown | unknown |
|
||||
| tst.ts:49:15:49:20 | string | string |
|
||||
| type_alias.ts:1:6:1:6 | B | boolean |
|
||||
| type_alias.ts:1:10:1:16 | boolean | boolean |
|
||||
| type_alias.ts:3:8:3:8 | B | boolean |
|
||||
| type_alias.ts:5:6:5:17 | ValueOrArray | ValueOrArray<T> |
|
||||
| type_alias.ts:5:19:5:19 | T | T |
|
||||
| type_alias.ts:5:24:5:24 | T | T |
|
||||
| type_alias.ts:5:24:5:49 | T \| Arr ... ray<T>> | T \| ValueOrArray<T>[] |
|
||||
| type_alias.ts:5:28:5:32 | Array | T[] |
|
||||
| type_alias.ts:5:28:5:49 | Array<V ... ray<T>> | ValueOrArray<T>[] |
|
||||
| type_alias.ts:5:34:5:45 | ValueOrArray | ValueOrArray<T> |
|
||||
| type_alias.ts:5:34:5:48 | ValueOrArray<T> | ValueOrArray<T> |
|
||||
| type_alias.ts:5:47:5:47 | T | T |
|
||||
| type_alias.ts:7:8:7:19 | ValueOrArray | ValueOrArray<T> |
|
||||
| type_alias.ts:7:8:7:27 | ValueOrArray<number> | ValueOrArray<number> |
|
||||
| type_alias.ts:7:21:7:26 | number | number |
|
||||
| type_alias.ts:9:6:9:9 | Json | Json |
|
||||
| type_alias.ts:10:5:15:12 | \| strin ... Json[] | string \| number \| boolean \| { [property: string... |
|
||||
| type_alias.ts:10:7:10:12 | string | string |
|
||||
| type_alias.ts:11:7:11:12 | number | number |
|
||||
| type_alias.ts:12:7:12:13 | boolean | boolean |
|
||||
| type_alias.ts:13:7:13:10 | null | null |
|
||||
| type_alias.ts:14:7:14:34 | { [prop ... Json } | { [property: string]: Json; } |
|
||||
| type_alias.ts:14:20:14:25 | string | string |
|
||||
| type_alias.ts:14:29:14:32 | Json | Json |
|
||||
| type_alias.ts:15:7:15:10 | Json | Json |
|
||||
| type_alias.ts:15:7:15:12 | Json[] | Json[] |
|
||||
| type_alias.ts:17:11:17:14 | Json | Json |
|
||||
| type_alias.ts:19:6:19:16 | VirtualNode | VirtualNode |
|
||||
| type_alias.ts:20:5:21:56 | \| strin ... Node[]] | string \| [string, { [key: string]: any; }, ...V... |
|
||||
| type_alias.ts:20:7:20:12 | string | string |
|
||||
| type_alias.ts:21:7:21:56 | [string ... Node[]] | [string, { [key: string]: any; }, ...VirtualNod... |
|
||||
| type_alias.ts:21:8:21:13 | string | string |
|
||||
| type_alias.ts:21:16:21:37 | { [key: ... : any } | { [key: string]: any; } |
|
||||
| type_alias.ts:21:24:21:29 | string | string |
|
||||
| type_alias.ts:21:33:21:35 | any | any |
|
||||
| type_alias.ts:21:40:21:55 | ...VirtualNode[] | VirtualNode |
|
||||
| type_alias.ts:21:43:21:53 | VirtualNode | VirtualNode |
|
||||
| type_alias.ts:21:43:21:55 | VirtualNode[] | VirtualNode[] |
|
||||
| type_alias.ts:23:15:23:25 | VirtualNode | VirtualNode |
|
||||
| type_definitions.ts:3:11:3:11 | I | I<S> |
|
||||
| type_definitions.ts:3:13:3:13 | S | S |
|
||||
| type_definitions.ts:4:6:4:6 | S | S |
|
||||
| type_definitions.ts:6:8:6:8 | I | I<S> |
|
||||
| type_definitions.ts:6:8:6:16 | I<number> | I<number> |
|
||||
| type_definitions.ts:6:10:6:15 | number | number |
|
||||
| type_definitions.ts:8:9:8:9 | T | T |
|
||||
| type_definitions.ts:9:6:9:6 | T | T |
|
||||
| type_definitions.ts:11:8:11:8 | C | C<T> |
|
||||
| type_definitions.ts:11:8:11:16 | C<number> | C<number> |
|
||||
| type_definitions.ts:11:10:11:15 | number | number |
|
||||
| type_definitions.ts:16:12:16:16 | Color | Color |
|
||||
| type_definitions.ts:19:8:19:24 | EnumWithOneMember | EnumWithOneMember |
|
||||
| type_definitions.ts:21:6:21:10 | Alias | Alias<T> |
|
||||
| type_definitions.ts:21:12:21:12 | T | T |
|
||||
| type_definitions.ts:21:17:21:17 | T | T |
|
||||
| type_definitions.ts:21:17:21:19 | T[] | T[] |
|
||||
| type_definitions.ts:22:26:22:30 | Alias | Alias<T> |
|
||||
| type_definitions.ts:22:26:22:38 | Alias<number> | Alias<number> |
|
||||
| type_definitions.ts:22:32:22:37 | number | number |
|
||||
missingToString
|
||||
referenceDefinition
|
||||
| Alias<T> | type_definitions.ts:21:1:21:20 | type Alias<T> = T[]; |
|
||||
| Alias<number> | type_definitions.ts:21:1:21:20 | type Alias<T> = T[]; |
|
||||
| C | type_definition_objects.ts:3:8:3:17 | class C {} |
|
||||
| C<T> | type_definitions.ts:8:1:10:1 | class C ... x: T\\n} |
|
||||
| C<number> | type_definitions.ts:8:1:10:1 | class C ... x: T\\n} |
|
||||
| Color | type_definitions.ts:13:1:15:1 | enum Co ... blue\\n} |
|
||||
| Color.blue | type_definitions.ts:14:15:14:18 | blue |
|
||||
| Color.green | type_definitions.ts:14:8:14:12 | green |
|
||||
| Color.red | type_definitions.ts:14:3:14:5 | red |
|
||||
| E | type_definition_objects.ts:6:8:6:16 | enum E {} |
|
||||
| EnumWithOneMember | type_definitions.ts:18:26:18:31 | member |
|
||||
| I<S> | type_definitions.ts:3:1:5:1 | interfa ... x: S;\\n} |
|
||||
| I<number> | type_definitions.ts:3:1:5:1 | interfa ... x: S;\\n} |
|
||||
| Json | type_alias.ts:9:1:15:13 | type Js ... Json[]; |
|
||||
| ValueOrArray<T> | type_alias.ts:5:1:5:50 | type Va ... ay<T>>; |
|
||||
| ValueOrArray<number> | type_alias.ts:5:1:5:50 | type Va ... ay<T>>; |
|
||||
| VirtualNode | type_alias.ts:19:1:21:57 | type Vi ... ode[]]; |
|
||||
tupleTypes
|
||||
| tst.ts:34:5:34:9 | tuple | [number, string] | 0 | number | 2 | no-rest |
|
||||
| tst.ts:34:5:34:9 | tuple | [number, string] | 1 | string | 2 | no-rest |
|
||||
| tst.ts:36:5:36:28 | tupleWi ... Element | [number, string, number?] | 0 | number | 2 | no-rest |
|
||||
| tst.ts:36:5:36:28 | tupleWi ... Element | [number, string, number?] | 1 | string | 2 | no-rest |
|
||||
| tst.ts:36:5:36:28 | tupleWi ... Element | [number, string, number?] | 2 | number | 2 | no-rest |
|
||||
| tst.ts:38:5:38:24 | tupleWithRestElement | [number, ...string[]] | 0 | number | 1 | string |
|
||||
| tst.ts:38:5:38:24 | tupleWithRestElement | [number, ...string[]] | 1 | string | 1 | string |
|
||||
| tst.ts:39:5:39:36 | tupleWi ... lements | [number, string?, ...number[]] | 0 | number | 1 | number |
|
||||
| tst.ts:39:5:39:36 | tupleWi ... lements | [number, string?, ...number[]] | 1 | string | 1 | number |
|
||||
| tst.ts:39:5:39:36 | tupleWi ... lements | [number, string?, ...number[]] | 2 | number | 1 | number |
|
||||
| tst.ts:42:5:42:21 | constArrayLiteral | readonly [1, 2] | 0 | 1 | 2 | no-rest |
|
||||
| tst.ts:42:5:42:21 | constArrayLiteral | readonly [1, 2] | 1 | 2 | 2 | no-rest |
|
||||
| tst.ts:42:25:42:30 | [1, 2] | readonly [1, 2] | 0 | 1 | 2 | no-rest |
|
||||
| tst.ts:42:25:42:30 | [1, 2] | readonly [1, 2] | 1 | 2 | 2 | no-rest |
|
||||
| tst.ts:42:25:42:39 | [1, 2] as const | readonly [1, 2] | 0 | 1 | 2 | no-rest |
|
||||
| tst.ts:42:25:42:39 | [1, 2] as const | readonly [1, 2] | 1 | 2 | 2 | no-rest |
|
||||
unknownType
|
||||
| tst.ts:40:5:40:15 | unknownType | unknown |
|
||||
| tst.ts:47:8:47:8 | e | unknown |
|
||||
| tst.ts:48:14:48:14 | e | unknown |
|
||||
37
javascript/ql/test/library-tests/TypeScript/Types/tests.ql
Normal file
37
javascript/ql/test/library-tests/TypeScript/Types/tests.ql
Normal file
@@ -0,0 +1,37 @@
|
||||
import javascript
|
||||
|
||||
// Ensure `true | false` and `false | true` are not distinct boolean types.
|
||||
query predicate booleans(BooleanType t) { any() }
|
||||
|
||||
query predicate getExprType(Expr expr, Type type) { type = expr.getType() }
|
||||
|
||||
query predicate getTypeDefinitionType(TypeDefinition def, Type type) { type = def.getType() }
|
||||
|
||||
query predicate getTypeExprType(TypeExpr e, Type type) { e.getType() = type }
|
||||
|
||||
query predicate missingToString(Type typ, string msg) {
|
||||
not exists(typ.toString()) and
|
||||
msg = "Missing toString for " + typ.getAQlClass()
|
||||
}
|
||||
|
||||
query predicate referenceDefinition(TypeReference ref, TypeDefinition def) {
|
||||
def = ref.getADefinition()
|
||||
}
|
||||
|
||||
string getRest(TupleType tuple) {
|
||||
if tuple.hasRestElement()
|
||||
then result = tuple.getRestElementType().toString()
|
||||
else result = "no-rest"
|
||||
}
|
||||
|
||||
query predicate tupleTypes(Expr e, TupleType tuple, int n, Type element, int minLength, string rest) {
|
||||
e.getType() = tuple and
|
||||
element = tuple.getElementType(n) and
|
||||
minLength = tuple.getMinimumLength() and
|
||||
rest = getRest(tuple)
|
||||
}
|
||||
|
||||
query predicate unknownType(Expr e,Type type) {
|
||||
type = e.getType() and
|
||||
e.getType() instanceof UnknownType
|
||||
}
|
||||
Reference in New Issue
Block a user