forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintersectionsOfLargeUnions.types
More file actions
125 lines (110 loc) · 3.83 KB
/
intersectionsOfLargeUnions.types
File metadata and controls
125 lines (110 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//// [tests/cases/compiler/intersectionsOfLargeUnions.ts] ////
=== Performance Stats ===
Assignability cache: 1,000
Type Count: 10,000
Instantiation count: 5,000
=== intersectionsOfLargeUnions.ts ===
// Repro from #23977
export function assertIsElement(node: Node | null): node is Element {
>assertIsElement : (node: Node | null) => node is Element
> : ^ ^^ ^^^^^
>node : Node | null
> : ^^^^^^^^^^^
let nodeType = node === null ? null : node.nodeType;
>nodeType : number | null
> : ^^^^^^^^^^^^^
>node === null ? null : node.nodeType : number | null
> : ^^^^^^^^^^^^^
>node === null : boolean
> : ^^^^^^^
>node : Node | null
> : ^^^^^^^^^^^
>node.nodeType : number
> : ^^^^^^
>node : Node
> : ^^^^
>nodeType : number
> : ^^^^^^
return nodeType === 1;
>nodeType === 1 : boolean
> : ^^^^^^^
>nodeType : number | null
> : ^^^^^^^^^^^^^
>1 : 1
> : ^
}
export function assertNodeTagName<
>assertNodeTagName : <T extends keyof ElementTagNameMap, U extends ElementTagNameMap[T]>(node: Node | null, tagName: T) => node is U
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
T extends keyof ElementTagNameMap,
U extends ElementTagNameMap[T]>(node: Node | null, tagName: T): node is U {
>node : Node | null
> : ^^^^^^^^^^^
>tagName : T
> : ^
if (assertIsElement(node)) {
>assertIsElement(node) : boolean
> : ^^^^^^^
>assertIsElement : (node: Node | null) => node is Element
> : ^ ^^ ^^^^^
>node : Node | null
> : ^^^^^^^^^^^
const nodeTagName = node.tagName.toLowerCase();
>nodeTagName : string
> : ^^^^^^
>node.tagName.toLowerCase() : string
> : ^^^^^^
>node.tagName.toLowerCase : () => string
> : ^^^^^^
>node.tagName : string
> : ^^^^^^
>node : Element
> : ^^^^^^^
>tagName : string
> : ^^^^^^
>toLowerCase : () => string
> : ^^^^^^
return nodeTagName === tagName;
>nodeTagName === tagName : boolean
> : ^^^^^^^
>nodeTagName : string
> : ^^^^^^
>tagName : T
> : ^
}
return false;
>false : false
> : ^^^^^
}
export function assertNodeProperty<
>assertNodeProperty : <T extends keyof ElementTagNameMap, P extends keyof ElementTagNameMap[T], V extends HTMLElementTagNameMap[T][P]>(node: Node | null, tagName: T, prop: P, value: V) => void
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
T extends keyof ElementTagNameMap,
P extends keyof ElementTagNameMap[T],
V extends HTMLElementTagNameMap[T][P]>(node: Node | null, tagName: T, prop: P, value: V) {
>node : Node | null
> : ^^^^^^^^^^^
>tagName : T
> : ^
>prop : P
> : ^
>value : V
> : ^
if (assertNodeTagName(node, tagName)) {
>assertNodeTagName(node, tagName) : boolean
> : ^^^^^^^
>assertNodeTagName : <T_1 extends keyof ElementTagNameMap, U extends ElementTagNameMap[T_1]>(node: Node | null, tagName: T_1) => node is U
> : ^^^^^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
>node : Node | null
> : ^^^^^^^^^^^
>tagName : T
> : ^
node[prop];
>node[prop] : ElementTagNameMap[T][P]
> : ^^^^^^^^^^^^^^^^^^^^^^^
>node : ElementTagNameMap[T]
> : ^^^^^^^^^^^^^^^^^^^^
>prop : P
> : ^
}
}