File: excessPropertyCheckWithMultipleDiscriminants.symbols

package info (click to toggle)
node-typescript 5.1.6%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 492,516 kB
  • sloc: javascript: 2,078,951; makefile: 6; sh: 1
file content (325 lines) | stat: -rw-r--r-- 14,023 bytes parent folder | download
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
=== tests/cases/compiler/excessPropertyCheckWithMultipleDiscriminants.ts ===
// Repro from #32657

interface Base<T> {
>Base : Symbol(Base, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 0, 0))
>T : Symbol(T, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 2, 15))

    value: T;
>value : Symbol(Base.value, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 2, 19))
>T : Symbol(T, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 2, 15))
}

interface Int extends Base<number> {
>Int : Symbol(Int, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 4, 1))
>Base : Symbol(Base, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 0, 0))

    type: "integer";
>type : Symbol(Int.type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 6, 36))

    multipleOf?: number;
>multipleOf : Symbol(Int.multipleOf, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 7, 20))
}

interface Float extends Base<number> {
>Float : Symbol(Float, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 9, 1))
>Base : Symbol(Base, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 0, 0))

    type: "number";
>type : Symbol(Float.type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 11, 38))
}

interface Str extends Base<string> {
>Str : Symbol(Str, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 13, 1))
>Base : Symbol(Base, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 0, 0))

    type: "string";
>type : Symbol(Str.type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 15, 36))

    format?: string;
>format : Symbol(Str.format, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 16, 19))
}

interface Bool extends Base<boolean> {
>Bool : Symbol(Bool, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 18, 1))
>Base : Symbol(Base, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 0, 0))

    type: "boolean";
>type : Symbol(Bool.type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 20, 38))
}

type Primitive = Int | Float | Str | Bool;
>Primitive : Symbol(Primitive, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 22, 1))
>Int : Symbol(Int, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 4, 1))
>Float : Symbol(Float, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 9, 1))
>Str : Symbol(Str, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 13, 1))
>Bool : Symbol(Bool, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 18, 1))

const foo: Primitive = {
>foo : Symbol(foo, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 26, 5))
>Primitive : Symbol(Primitive, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 22, 1))

    type: "number",
>type : Symbol(type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 26, 24))

    value: 10,
>value : Symbol(value, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 27, 19))

    multipleOf: 5, // excess property
>multipleOf : Symbol(multipleOf, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 28, 14))

    format: "what?"
>format : Symbol(format, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 29, 18))
}


type DisjointDiscriminants = { p1: 'left'; p2: true; p3: number } | { p1: 'right'; p2: false; p4: string } | { p1: 'left'; p2: boolean };
>DisjointDiscriminants : Symbol(DisjointDiscriminants, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 31, 1))
>p1 : Symbol(p1, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 34, 30))
>p2 : Symbol(p2, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 34, 42))
>p3 : Symbol(p3, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 34, 52))
>p1 : Symbol(p1, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 34, 69))
>p2 : Symbol(p2, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 34, 82))
>p4 : Symbol(p4, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 34, 93))
>p1 : Symbol(p1, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 34, 110))
>p2 : Symbol(p2, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 34, 122))

// This has excess error because variant three is the only applicable case.
const a: DisjointDiscriminants = {
>a : Symbol(a, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 37, 5))
>DisjointDiscriminants : Symbol(DisjointDiscriminants, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 31, 1))

    p1: 'left',
>p1 : Symbol(p1, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 37, 34))

    p2: false,
>p2 : Symbol(p2, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 38, 15))

    p3: 42,
>p3 : Symbol(p3, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 39, 14))

    p4: "hello"
>p4 : Symbol(p4, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 40, 11))

};

// This has excess error because variant two is not applicable.
const b: DisjointDiscriminants = {
>b : Symbol(b, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 45, 5))
>DisjointDiscriminants : Symbol(DisjointDiscriminants, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 31, 1))

    p1: 'left',
>p1 : Symbol(p1, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 45, 34))

    p2: true,
>p2 : Symbol(p2, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 46, 15))

    p3: 42,
>p3 : Symbol(p3, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 47, 13))

    p4: "hello"
>p4 : Symbol(p4, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 48, 11))

};

// This has excess error because variant two is the only applicable case
const c: DisjointDiscriminants = {
>c : Symbol(c, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 53, 5))
>DisjointDiscriminants : Symbol(DisjointDiscriminants, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 31, 1))

    p1: 'right',
>p1 : Symbol(p1, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 53, 34))

    p2: false,
>p2 : Symbol(p2, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 54, 16))

    p3: 42,
>p3 : Symbol(p3, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 55, 14))

    p4: "hello"
>p4 : Symbol(p4, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 56, 11))

};

// Repro from #51873

interface Common {
>Common : Symbol(Common, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 58, 2))

    type: "A" | "B" | "C" | "D";
>type : Symbol(Common.type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 62, 18))

    n: number;
>n : Symbol(Common.n, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 63, 32))
}
interface A {
>A : Symbol(A, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 65, 1))

    type: "A";
>type : Symbol(A.type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 66, 13))

    a?: number;
>a : Symbol(A.a, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 67, 14))
}
interface B {
>B : Symbol(B, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 69, 1))

    type: "B";
>type : Symbol(B.type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 70, 13))

    b?: number;
>b : Symbol(B.b, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 71, 14))
}

type CommonWithOverlappingOptionals = Common | (Common & A) | (Common & B);
>CommonWithOverlappingOptionals : Symbol(CommonWithOverlappingOptionals, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 73, 1))
>Common : Symbol(Common, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 58, 2))
>Common : Symbol(Common, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 58, 2))
>A : Symbol(A, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 65, 1))
>Common : Symbol(Common, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 58, 2))
>B : Symbol(B, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 69, 1))

// Should reject { b } because reduced to Common | (Common & A)
const c1: CommonWithOverlappingOptionals = {
>c1 : Symbol(c1, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 78, 5))
>CommonWithOverlappingOptionals : Symbol(CommonWithOverlappingOptionals, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 73, 1))

    type: "A",
>type : Symbol(type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 78, 44))

    n: 1,
>n : Symbol(n, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 79, 14))

    a: 1,
>a : Symbol(a, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 80, 9))

    b: 1  // excess property
>b : Symbol(b, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 81, 9))
}

type CommonWithDisjointOverlappingOptionals = Common | A | B;
>CommonWithDisjointOverlappingOptionals : Symbol(CommonWithDisjointOverlappingOptionals, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 83, 1))
>Common : Symbol(Common, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 58, 2))
>A : Symbol(A, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 65, 1))
>B : Symbol(B, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 69, 1))

// Should still reject { b } because reduced to Common | A, even though these are now disjoint
const c2: CommonWithDisjointOverlappingOptionals = {
>c2 : Symbol(c2, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 88, 5))
>CommonWithDisjointOverlappingOptionals : Symbol(CommonWithDisjointOverlappingOptionals, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 83, 1))

    type: "A",
>type : Symbol(type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 88, 52))

    n: 1,
>n : Symbol(n, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 89, 14))

    a: 1,
>a : Symbol(a, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 90, 9))

    b: 1  // excess property
>b : Symbol(b, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 91, 9))
}

// Repro from https://github.com/microsoft/TypeScript/pull/51884#issuecomment-1472736068

export type BaseAttribute<T> = {
>BaseAttribute : Symbol(BaseAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 93, 1))
>T : Symbol(T, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 97, 26))

    type?: string | undefined;
>type : Symbol(type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 97, 32))

    required?: boolean | undefined;
>required : Symbol(required, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 98, 30))

    defaultsTo?: T | undefined;
>defaultsTo : Symbol(defaultsTo, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 99, 35))
>T : Symbol(T, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 97, 26))

};

export type Attribute =
>Attribute : Symbol(Attribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 101, 2))

    | string
    | StringAttribute
>StringAttribute : Symbol(StringAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 112, 21))

    | NumberAttribute
>NumberAttribute : Symbol(NumberAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 116, 2))

    | OneToOneAttribute
>OneToOneAttribute : Symbol(OneToOneAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 121, 2))

export type Attribute2 =
>Attribute2 : Symbol(Attribute2, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 107, 23))

    | string
    | StringAttribute
>StringAttribute : Symbol(StringAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 112, 21))

    | NumberAttribute
>NumberAttribute : Symbol(NumberAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 116, 2))

export type StringAttribute = BaseAttribute<string> & {
>StringAttribute : Symbol(StringAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 112, 21))
>BaseAttribute : Symbol(BaseAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 93, 1))

    type: 'string';
>type : Symbol(type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 114, 55))

};

export type NumberAttribute = BaseAttribute<number> & {
>NumberAttribute : Symbol(NumberAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 116, 2))
>BaseAttribute : Symbol(BaseAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 93, 1))

    type: 'number';
>type : Symbol(type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 118, 55))

    autoIncrement?: boolean | undefined;
>autoIncrement : Symbol(autoIncrement, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 119, 19))

};

export type OneToOneAttribute = BaseAttribute<any> & {
>OneToOneAttribute : Symbol(OneToOneAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 121, 2))
>BaseAttribute : Symbol(BaseAttribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 93, 1))

    model: string;
>model : Symbol(model, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 123, 54))

};

// both should error due to excess properties
const attributes: Attribute = {
>attributes : Symbol(attributes, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 128, 5))
>Attribute : Symbol(Attribute, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 101, 2))

    type: 'string',
>type : Symbol(type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 128, 31))

    autoIncrement: true,
>autoIncrement : Symbol(autoIncrement, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 129, 19))

    required: true,
>required : Symbol(required, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 130, 24))

};

const attributes2: Attribute2 = {
>attributes2 : Symbol(attributes2, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 134, 5))
>Attribute2 : Symbol(Attribute2, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 107, 23))

    type: 'string',
>type : Symbol(type, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 134, 33))

    autoIncrement: true,
>autoIncrement : Symbol(autoIncrement, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 135, 19))

    required: true,
>required : Symbol(required, Decl(excessPropertyCheckWithMultipleDiscriminants.ts, 136, 24))

};