-
Notifications
You must be signed in to change notification settings - Fork 12.2k
/
noAsConstNameLookup.types
83 lines (66 loc) · 2.02 KB
/
noAsConstNameLookup.types
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
=== tests/cases/compiler/noAsConstNameLookup.ts ===
// Repros from #44292
type Store = { a: 123 }
>Store : Store
>a : 123
export type Cleaner = <W extends Store>(runner: FeatureRunner<W>) => Promise<any>
>Cleaner : Cleaner
>runner : FeatureRunner<W>
export class FeatureRunner<W extends Store> {
>FeatureRunner : FeatureRunner<W>
private readonly cleaners: Cleaner[] = []
>cleaners : Cleaner[]
>[] : never[]
async runFeature(): Promise<any> {
>runFeature : () => Promise<any>
const objectWhichShouldBeConst = {
>objectWhichShouldBeConst : { readonly flags: {}; readonly settings: {}; }
>{ flags: {}, settings: {}, } as const : { readonly flags: {}; readonly settings: {}; }
>{ flags: {}, settings: {}, } : { readonly flags: {}; readonly settings: {}; }
flags: {},
>flags : {}
>{} : {}
settings: {},
>settings : {}
>{} : {}
} as const;
return objectWhichShouldBeConst
>objectWhichShouldBeConst : { readonly flags: {}; readonly settings: {}; }
}
async run(): Promise<any> {
>run : () => Promise<any>
const result = {}
>result : {}
>{} : {}
this.cleaners.forEach(c => c(this))
>this.cleaners.forEach(c => c(this)) : void
>this.cleaners.forEach : (callbackfn: (value: Cleaner, index: number, array: Cleaner[]) => void, thisArg?: any) => void
>this.cleaners : Cleaner[]
>this : this
>cleaners : Cleaner[]
>forEach : (callbackfn: (value: Cleaner, index: number, array: Cleaner[]) => void, thisArg?: any) => void
>c => c(this) : (c: Cleaner) => Promise<any>
>c : Cleaner
>c(this) : Promise<any>
>c : Cleaner
>this : this
return result
>result : {}
}
}
export class C<T> {
>C : C<T>
f(): void {
>f : () => void
let one = 1 as const;
>one : 1
>1 as const : 1
>1 : 1
}
}
new C<string>().f();
>new C<string>().f() : void
>new C<string>().f : () => void
>new C<string>() : C<string>
>C : typeof C
>f : () => void