-
Notifications
You must be signed in to change notification settings - Fork 12.8k
/
Copy pathintersectionsAndOptionalProperties.symbols
64 lines (50 loc) · 2.77 KB
/
intersectionsAndOptionalProperties.symbols
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
=== tests/cases/compiler/intersectionsAndOptionalProperties.ts ===
declare let x: { a?: number, b: string };
>x : Symbol(x, Decl(intersectionsAndOptionalProperties.ts, 0, 11))
>a : Symbol(a, Decl(intersectionsAndOptionalProperties.ts, 0, 16))
>b : Symbol(b, Decl(intersectionsAndOptionalProperties.ts, 0, 28))
declare let y: { a: null, b: string };
>y : Symbol(y, Decl(intersectionsAndOptionalProperties.ts, 1, 11))
>a : Symbol(a, Decl(intersectionsAndOptionalProperties.ts, 1, 16))
>b : Symbol(b, Decl(intersectionsAndOptionalProperties.ts, 1, 25))
declare let z: { a: null } & { b: string };
>z : Symbol(z, Decl(intersectionsAndOptionalProperties.ts, 2, 11))
>a : Symbol(a, Decl(intersectionsAndOptionalProperties.ts, 2, 16))
>b : Symbol(b, Decl(intersectionsAndOptionalProperties.ts, 2, 30))
x = y; // Error
>x : Symbol(x, Decl(intersectionsAndOptionalProperties.ts, 0, 11))
>y : Symbol(y, Decl(intersectionsAndOptionalProperties.ts, 1, 11))
x = z; // Error
>x : Symbol(x, Decl(intersectionsAndOptionalProperties.ts, 0, 11))
>z : Symbol(z, Decl(intersectionsAndOptionalProperties.ts, 2, 11))
// Repro from #36604
interface To {
>To : Symbol(To, Decl(intersectionsAndOptionalProperties.ts, 5, 6))
field?: number;
>field : Symbol(To.field, Decl(intersectionsAndOptionalProperties.ts, 9, 14))
anotherField: string;
>anotherField : Symbol(To.anotherField, Decl(intersectionsAndOptionalProperties.ts, 10, 19))
}
type From = { field: null } & Omit<To, 'field'>;
>From : Symbol(From, Decl(intersectionsAndOptionalProperties.ts, 12, 1))
>field : Symbol(field, Decl(intersectionsAndOptionalProperties.ts, 14, 14))
>Omit : Symbol(Omit, Decl(lib.es5.d.ts, --, --))
>To : Symbol(To, Decl(intersectionsAndOptionalProperties.ts, 5, 6))
function foo(v: From) {
>foo : Symbol(foo, Decl(intersectionsAndOptionalProperties.ts, 14, 49))
>v : Symbol(v, Decl(intersectionsAndOptionalProperties.ts, 16, 13))
>From : Symbol(From, Decl(intersectionsAndOptionalProperties.ts, 12, 1))
let x: To;
>x : Symbol(x, Decl(intersectionsAndOptionalProperties.ts, 17, 7))
>To : Symbol(To, Decl(intersectionsAndOptionalProperties.ts, 5, 6))
x = v; // Error
>x : Symbol(x, Decl(intersectionsAndOptionalProperties.ts, 17, 7))
>v : Symbol(v, Decl(intersectionsAndOptionalProperties.ts, 16, 13))
x.field = v.field; // Error
>x.field : Symbol(To.field, Decl(intersectionsAndOptionalProperties.ts, 9, 14))
>x : Symbol(x, Decl(intersectionsAndOptionalProperties.ts, 17, 7))
>field : Symbol(To.field, Decl(intersectionsAndOptionalProperties.ts, 9, 14))
>v.field : Symbol(field, Decl(intersectionsAndOptionalProperties.ts, 14, 14))
>v : Symbol(v, Decl(intersectionsAndOptionalProperties.ts, 16, 13))
>field : Symbol(field, Decl(intersectionsAndOptionalProperties.ts, 14, 14))
}