TS: Add recursive type alias tests (already works)

This commit is contained in:
Asger F
2019-10-30 15:02:08 +00:00
parent b81931e402
commit 341c11523c
5 changed files with 91 additions and 0 deletions

View File

@@ -93,6 +93,30 @@
| tst.ts:43:28:43:30 | foo | "foo" |
| tst.ts:43:33:43:37 | "foo" | "foo" |
| 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 dummy.ts |
| type_definition_objects.ts:1:24:1:32 | "./dummy" | any |
| type_definition_objects.ts:3:14:3:14 | C | C |

View File

@@ -1,4 +1,7 @@
| 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> |

View File

@@ -71,6 +71,42 @@
| 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>> | 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[] | Json |
| 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[]] | VirtualNode |
| 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 |

View File

@@ -11,3 +11,7 @@
| 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[]]; |

View File

@@ -1,3 +1,27 @@
type B = boolean;
var b: B;
type ValueOrArray<T> = T | Array<ValueOrArray<T>>;
var c: ValueOrArray<number>;
type Json =
| string
| number
| boolean
| null
| { [property: string]: Json }
| Json[];
var json: Json;
type VirtualNode =
| string
| [string, { [key: string]: any }, ...VirtualNode[]];
const myNode: VirtualNode =
["div", { id: "parent" },
["div", { id: "first-child" }, "I'm the first child"],
["div", { id: "second-child" }, "I'm the second child"]
];