-
Notifications
You must be signed in to change notification settings - Fork 12.2k
/
typeGuardsWithInstanceOf.symbols
81 lines (61 loc) · 2.76 KB
/
typeGuardsWithInstanceOf.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
=== tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOf.ts ===
interface I { global: string; }
>I : Symbol(I, Decl(typeGuardsWithInstanceOf.ts, 0, 0))
>global : Symbol(I.global, Decl(typeGuardsWithInstanceOf.ts, 0, 13))
var result!: I;
>result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3))
>I : Symbol(I, Decl(typeGuardsWithInstanceOf.ts, 0, 0))
var result2!: I;
>result2 : Symbol(result2, Decl(typeGuardsWithInstanceOf.ts, 2, 3))
>I : Symbol(I, Decl(typeGuardsWithInstanceOf.ts, 0, 0))
if (!(result instanceof RegExp)) {
>result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3))
>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
result = result2;
>result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3))
>result2 : Symbol(result2, Decl(typeGuardsWithInstanceOf.ts, 2, 3))
} else if (!result.global) {
>result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3))
}
// Repro from #31155
interface OnChanges {
>OnChanges : Symbol(OnChanges, Decl(typeGuardsWithInstanceOf.ts, 7, 1))
onChanges(changes: Record<string, unknown>): void
>onChanges : Symbol(OnChanges.onChanges, Decl(typeGuardsWithInstanceOf.ts, 11, 21))
>changes : Symbol(changes, Decl(typeGuardsWithInstanceOf.ts, 12, 14))
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
}
interface Validator {
>Validator : Symbol(Validator, Decl(typeGuardsWithInstanceOf.ts, 13, 1))
validate(): null | Record<string, unknown>;
>validate : Symbol(Validator.validate, Decl(typeGuardsWithInstanceOf.ts, 14, 21))
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
}
class C {
>C : Symbol(C, Decl(typeGuardsWithInstanceOf.ts, 16, 1))
validate() {
>validate : Symbol(C.validate, Decl(typeGuardsWithInstanceOf.ts, 18, 9))
return {}
}
}
function foo() {
>foo : Symbol(foo, Decl(typeGuardsWithInstanceOf.ts, 22, 1))
let v: Validator & Partial<OnChanges> = null as any;
>v : Symbol(v, Decl(typeGuardsWithInstanceOf.ts, 25, 7))
>Validator : Symbol(Validator, Decl(typeGuardsWithInstanceOf.ts, 13, 1))
>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --))
>OnChanges : Symbol(OnChanges, Decl(typeGuardsWithInstanceOf.ts, 7, 1))
if (v instanceof C) {
>v : Symbol(v, Decl(typeGuardsWithInstanceOf.ts, 25, 7))
>C : Symbol(C, Decl(typeGuardsWithInstanceOf.ts, 16, 1))
v // Validator & Partial<OnChanges> & C
>v : Symbol(v, Decl(typeGuardsWithInstanceOf.ts, 25, 7))
}
v // Validator & Partial<OnChanges> via subtype reduction
>v : Symbol(v, Decl(typeGuardsWithInstanceOf.ts, 25, 7))
if (v.onChanges) {
>v : Symbol(v, Decl(typeGuardsWithInstanceOf.ts, 25, 7))
v.onChanges({});
>v : Symbol(v, Decl(typeGuardsWithInstanceOf.ts, 25, 7))
}
}