forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnoImplicitThisFunctions2.types
More file actions
116 lines (97 loc) · 3.45 KB
/
noImplicitThisFunctions2.types
File metadata and controls
116 lines (97 loc) · 3.45 KB
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
//// [tests/cases/compiler/noImplicitThisFunctions2.ts] ////
=== noImplicitThisFunctions2.ts ===
// https://github.com/microsoft/TypeScript/issues/63001
function f1() {
>f1 : () => () => any
> : ^^^^^^^^^^^^^^^
return () => this;
>() => this : () => any
> : ^^^^^^^^^
>this : any
> : ^^^
}
function f2(this: typeof globalThis) {
>f2 : (this: typeof globalThis) => () => typeof globalThis
> : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
>globalThis : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
return () => this;
>() => this : () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^
>this : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
}
const f3 = () => this;
>f3 : () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^
>() => this : () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^
>this : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
function f4(this: typeof globalThis) {
>f4 : (this: typeof globalThis) => () => () => typeof globalThis
> : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
>globalThis : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
const inner = () => {
>inner : () => () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>() => { return () => this; } : () => () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return () => this;
>() => this : () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^
>this : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
};
return inner;
>inner : () => () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
class C1 {
>C1 : C1
> : ^^
static method(this: typeof globalThis) {
>method : (this: typeof globalThis) => () => typeof globalThis
> : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
>globalThis : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
return () => this;
>() => this : () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^
>this : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
}
}
const obj1 = {
>obj1 : { arr: () => typeof globalThis; method(this: typeof globalThis): () => typeof globalThis; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>{ arr: () => this, method(this: typeof globalThis) { return () => this; },} : { arr: () => typeof globalThis; method(this: typeof globalThis): () => typeof globalThis; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
arr: () => this,
>arr : () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^
>() => this : () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^
>this : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
method(this: typeof globalThis) {
>method : (this: typeof globalThis) => () => typeof globalThis
> : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
>globalThis : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
return () => this;
>() => this : () => typeof globalThis
> : ^^^^^^^^^^^^^^^^^^^^^^^
>this : typeof globalThis
> : ^^^^^^^^^^^^^^^^^
},
};