File: unionTypeConstructSignatures.symbols

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (246 lines) | stat: -rw-r--r-- 16,489 bytes parent folder | download | duplicates (2)
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
=== tests/cases/conformance/types/union/unionTypeConstructSignatures.ts ===
var numOrDate: number | Date;
>numOrDate : Symbol(numOrDate, Decl(unionTypeConstructSignatures.ts, 0, 3))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))

var strOrBoolean: string | boolean;
>strOrBoolean : Symbol(strOrBoolean, Decl(unionTypeConstructSignatures.ts, 1, 3))

var strOrNum: string | number;
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))

// If each type in U has construct signatures and the sets of construct signatures are identical ignoring return types, 
// U has the same set of construct signatures, but with return types that are unions of the return types of the respective construct signatures from each type in U.
var unionOfDifferentReturnType: { new (a: number): number; } | { new (a: number): Date; };
>unionOfDifferentReturnType : Symbol(unionOfDifferentReturnType, Decl(unionTypeConstructSignatures.ts, 6, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 6, 39))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 6, 70))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))

numOrDate = new unionOfDifferentReturnType(10);
>numOrDate : Symbol(numOrDate, Decl(unionTypeConstructSignatures.ts, 0, 3))
>unionOfDifferentReturnType : Symbol(unionOfDifferentReturnType, Decl(unionTypeConstructSignatures.ts, 6, 3))

strOrBoolean = new unionOfDifferentReturnType("hello"); // error 
>strOrBoolean : Symbol(strOrBoolean, Decl(unionTypeConstructSignatures.ts, 1, 3))
>unionOfDifferentReturnType : Symbol(unionOfDifferentReturnType, Decl(unionTypeConstructSignatures.ts, 6, 3))

new unionOfDifferentReturnType1(true); // error in type of parameter
>unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeConstructSignatures.ts, 11, 3))

var unionOfDifferentReturnType1: { new (a: number): number; new (a: string): string; } | { new (a: number): Date; new (a: string): boolean; };
>unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeConstructSignatures.ts, 11, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 11, 40))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 11, 65))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 11, 96))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 11, 119))

numOrDate = new unionOfDifferentReturnType1(10);
>numOrDate : Symbol(numOrDate, Decl(unionTypeConstructSignatures.ts, 0, 3))
>unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeConstructSignatures.ts, 11, 3))

strOrBoolean = new unionOfDifferentReturnType1("hello");
>strOrBoolean : Symbol(strOrBoolean, Decl(unionTypeConstructSignatures.ts, 1, 3))
>unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeConstructSignatures.ts, 11, 3))

new unionOfDifferentReturnType1(true); // error in type of parameter
>unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeConstructSignatures.ts, 11, 3))

new unionOfDifferentReturnType1(); // error missing parameter
>unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeConstructSignatures.ts, 11, 3))

var unionOfDifferentParameterTypes: { new (a: number): number; } | { new (a: string): Date; };
>unionOfDifferentParameterTypes : Symbol(unionOfDifferentParameterTypes, Decl(unionTypeConstructSignatures.ts, 17, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 17, 43))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 17, 74))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))

new unionOfDifferentParameterTypes(10);// error - no call signatures
>unionOfDifferentParameterTypes : Symbol(unionOfDifferentParameterTypes, Decl(unionTypeConstructSignatures.ts, 17, 3))

new unionOfDifferentParameterTypes("hello");// error - no call signatures
>unionOfDifferentParameterTypes : Symbol(unionOfDifferentParameterTypes, Decl(unionTypeConstructSignatures.ts, 17, 3))

new unionOfDifferentParameterTypes();// error - no call signatures
>unionOfDifferentParameterTypes : Symbol(unionOfDifferentParameterTypes, Decl(unionTypeConstructSignatures.ts, 17, 3))

var unionOfDifferentNumberOfSignatures: { new (a: number): number; } | { new (a: number): Date; new (a: string): boolean; };
>unionOfDifferentNumberOfSignatures : Symbol(unionOfDifferentNumberOfSignatures, Decl(unionTypeConstructSignatures.ts, 22, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 22, 47))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 22, 78))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 22, 101))

new unionOfDifferentNumberOfSignatures(); // error - no call signatures
>unionOfDifferentNumberOfSignatures : Symbol(unionOfDifferentNumberOfSignatures, Decl(unionTypeConstructSignatures.ts, 22, 3))

new unionOfDifferentNumberOfSignatures(10); // error - no call signatures
>unionOfDifferentNumberOfSignatures : Symbol(unionOfDifferentNumberOfSignatures, Decl(unionTypeConstructSignatures.ts, 22, 3))

new unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures
>unionOfDifferentNumberOfSignatures : Symbol(unionOfDifferentNumberOfSignatures, Decl(unionTypeConstructSignatures.ts, 22, 3))

var unionWithDifferentParameterCount: { new (a: string): string; } | { new (a: string, b: number): number; };
>unionWithDifferentParameterCount : Symbol(unionWithDifferentParameterCount, Decl(unionTypeConstructSignatures.ts, 27, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 27, 45))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 27, 76))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 27, 86))

new unionWithDifferentParameterCount();// needs more args
>unionWithDifferentParameterCount : Symbol(unionWithDifferentParameterCount, Decl(unionTypeConstructSignatures.ts, 27, 3))

new unionWithDifferentParameterCount("hello");// needs more args
>unionWithDifferentParameterCount : Symbol(unionWithDifferentParameterCount, Decl(unionTypeConstructSignatures.ts, 27, 3))

new unionWithDifferentParameterCount("hello", 10);// ok
>unionWithDifferentParameterCount : Symbol(unionWithDifferentParameterCount, Decl(unionTypeConstructSignatures.ts, 27, 3))

var unionWithOptionalParameter1: { new (a: string, b?: number): string; } | { new (a: string, b?: number): number; };
>unionWithOptionalParameter1 : Symbol(unionWithOptionalParameter1, Decl(unionTypeConstructSignatures.ts, 32, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 32, 40))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 32, 50))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 32, 83))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 32, 93))

strOrNum = new unionWithOptionalParameter1('hello');
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter1 : Symbol(unionWithOptionalParameter1, Decl(unionTypeConstructSignatures.ts, 32, 3))

strOrNum = new unionWithOptionalParameter1('hello', 10);
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter1 : Symbol(unionWithOptionalParameter1, Decl(unionTypeConstructSignatures.ts, 32, 3))

strOrNum = new unionWithOptionalParameter1('hello', "hello"); // error in parameter type
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter1 : Symbol(unionWithOptionalParameter1, Decl(unionTypeConstructSignatures.ts, 32, 3))

strOrNum = new unionWithOptionalParameter1(); // error
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter1 : Symbol(unionWithOptionalParameter1, Decl(unionTypeConstructSignatures.ts, 32, 3))

var unionWithOptionalParameter2: { new (a: string, b?: number): string; } | { new (a: string, b: number): number };
>unionWithOptionalParameter2 : Symbol(unionWithOptionalParameter2, Decl(unionTypeConstructSignatures.ts, 38, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 38, 40))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 38, 50))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 38, 83))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 38, 93))

strOrNum = new unionWithOptionalParameter2('hello'); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter2 : Symbol(unionWithOptionalParameter2, Decl(unionTypeConstructSignatures.ts, 38, 3))

strOrNum = new unionWithOptionalParameter2('hello', 10); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter2 : Symbol(unionWithOptionalParameter2, Decl(unionTypeConstructSignatures.ts, 38, 3))

strOrNum = new unionWithOptionalParameter2('hello', "hello"); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter2 : Symbol(unionWithOptionalParameter2, Decl(unionTypeConstructSignatures.ts, 38, 3))

strOrNum = new unionWithOptionalParameter2(); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter2 : Symbol(unionWithOptionalParameter2, Decl(unionTypeConstructSignatures.ts, 38, 3))

var unionWithOptionalParameter3: { new (a: string, b?: number): string; } | { new (a: string): number; };
>unionWithOptionalParameter3 : Symbol(unionWithOptionalParameter3, Decl(unionTypeConstructSignatures.ts, 44, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 44, 40))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 44, 50))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 44, 83))

strOrNum = new unionWithOptionalParameter3('hello'); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter3 : Symbol(unionWithOptionalParameter3, Decl(unionTypeConstructSignatures.ts, 44, 3))

strOrNum = new unionWithOptionalParameter3('hello', 10); // ok
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter3 : Symbol(unionWithOptionalParameter3, Decl(unionTypeConstructSignatures.ts, 44, 3))

strOrNum = new unionWithOptionalParameter3('hello', "hello"); // wrong type
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter3 : Symbol(unionWithOptionalParameter3, Decl(unionTypeConstructSignatures.ts, 44, 3))

strOrNum = new unionWithOptionalParameter3(); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithOptionalParameter3 : Symbol(unionWithOptionalParameter3, Decl(unionTypeConstructSignatures.ts, 44, 3))

var unionWithRestParameter1: { new (a: string, ...b: number[]): string; } | { new (a: string, ...b: number[]): number };
>unionWithRestParameter1 : Symbol(unionWithRestParameter1, Decl(unionTypeConstructSignatures.ts, 50, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 50, 36))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 50, 46))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 50, 83))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 50, 93))

strOrNum = new unionWithRestParameter1('hello');
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter1 : Symbol(unionWithRestParameter1, Decl(unionTypeConstructSignatures.ts, 50, 3))

strOrNum = new unionWithRestParameter1('hello', 10);
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter1 : Symbol(unionWithRestParameter1, Decl(unionTypeConstructSignatures.ts, 50, 3))

strOrNum = new unionWithRestParameter1('hello', 10, 11);
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter1 : Symbol(unionWithRestParameter1, Decl(unionTypeConstructSignatures.ts, 50, 3))

strOrNum = new unionWithRestParameter1('hello', "hello"); // error in parameter type
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter1 : Symbol(unionWithRestParameter1, Decl(unionTypeConstructSignatures.ts, 50, 3))

strOrNum = new unionWithRestParameter1(); // error
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter1 : Symbol(unionWithRestParameter1, Decl(unionTypeConstructSignatures.ts, 50, 3))

var unionWithRestParameter2: { new (a: string, ...b: number[]): string; } | { new (a: string, b: number): number };
>unionWithRestParameter2 : Symbol(unionWithRestParameter2, Decl(unionTypeConstructSignatures.ts, 57, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 57, 36))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 57, 46))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 57, 83))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 57, 93))

strOrNum = new unionWithRestParameter2('hello'); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter2 : Symbol(unionWithRestParameter2, Decl(unionTypeConstructSignatures.ts, 57, 3))

strOrNum = new unionWithRestParameter2('hello', 10); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter2 : Symbol(unionWithRestParameter2, Decl(unionTypeConstructSignatures.ts, 57, 3))

strOrNum = new unionWithRestParameter2('hello', 10, 11); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter2 : Symbol(unionWithRestParameter2, Decl(unionTypeConstructSignatures.ts, 57, 3))

strOrNum = new unionWithRestParameter2('hello', "hello"); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter2 : Symbol(unionWithRestParameter2, Decl(unionTypeConstructSignatures.ts, 57, 3))

strOrNum = new unionWithRestParameter2(); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter2 : Symbol(unionWithRestParameter2, Decl(unionTypeConstructSignatures.ts, 57, 3))

var unionWithRestParameter3: { new (a: string, ...b: number[]): string; } | { new (a: string): number };
>unionWithRestParameter3 : Symbol(unionWithRestParameter3, Decl(unionTypeConstructSignatures.ts, 64, 3))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 64, 36))
>b : Symbol(b, Decl(unionTypeConstructSignatures.ts, 64, 46))
>a : Symbol(a, Decl(unionTypeConstructSignatures.ts, 64, 83))

strOrNum = new unionWithRestParameter3('hello'); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter3 : Symbol(unionWithRestParameter3, Decl(unionTypeConstructSignatures.ts, 64, 3))

strOrNum = new unionWithRestParameter3('hello', 10); // ok
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter3 : Symbol(unionWithRestParameter3, Decl(unionTypeConstructSignatures.ts, 64, 3))

strOrNum = new unionWithRestParameter3('hello', 10, 11); // ok
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter3 : Symbol(unionWithRestParameter3, Decl(unionTypeConstructSignatures.ts, 64, 3))

strOrNum = new unionWithRestParameter3('hello', "hello"); // wrong type
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter3 : Symbol(unionWithRestParameter3, Decl(unionTypeConstructSignatures.ts, 64, 3))

strOrNum = new unionWithRestParameter3(); // error no call signature
>strOrNum : Symbol(strOrNum, Decl(unionTypeConstructSignatures.ts, 2, 3))
>unionWithRestParameter3 : Symbol(unionWithRestParameter3, Decl(unionTypeConstructSignatures.ts, 64, 3))