-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathnarrowingTypeofFunction.symbols
More file actions
45 lines (38 loc) · 1.46 KB
/
narrowingTypeofFunction.symbols
File metadata and controls
45 lines (38 loc) · 1.46 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
=== tests/cases/compiler/narrowingTypeofFunction.ts ===
type Meta = { foo: string }
>Meta : Symbol(Meta, Decl(narrowingTypeofFunction.ts, 0, 0))
>foo : Symbol(foo, Decl(narrowingTypeofFunction.ts, 0, 13))
interface F { (): string }
>F : Symbol(F, Decl(narrowingTypeofFunction.ts, 0, 27))
function f1(a: (F & Meta) | string) {
>f1 : Symbol(f1, Decl(narrowingTypeofFunction.ts, 1, 26))
>a : Symbol(a, Decl(narrowingTypeofFunction.ts, 3, 12))
>F : Symbol(F, Decl(narrowingTypeofFunction.ts, 0, 27))
>Meta : Symbol(Meta, Decl(narrowingTypeofFunction.ts, 0, 0))
if (typeof a === "function") {
>a : Symbol(a, Decl(narrowingTypeofFunction.ts, 3, 12))
a;
>a : Symbol(a, Decl(narrowingTypeofFunction.ts, 3, 12))
}
else {
a;
>a : Symbol(a, Decl(narrowingTypeofFunction.ts, 3, 12))
}
}
function f2<T>(x: (T & F) | T & string) {
>f2 : Symbol(f2, Decl(narrowingTypeofFunction.ts, 10, 1))
>T : Symbol(T, Decl(narrowingTypeofFunction.ts, 12, 12))
>x : Symbol(x, Decl(narrowingTypeofFunction.ts, 12, 15))
>T : Symbol(T, Decl(narrowingTypeofFunction.ts, 12, 12))
>F : Symbol(F, Decl(narrowingTypeofFunction.ts, 0, 27))
>T : Symbol(T, Decl(narrowingTypeofFunction.ts, 12, 12))
if (typeof x === "function") {
>x : Symbol(x, Decl(narrowingTypeofFunction.ts, 12, 15))
x;
>x : Symbol(x, Decl(narrowingTypeofFunction.ts, 12, 15))
}
else {
x;
>x : Symbol(x, Decl(narrowingTypeofFunction.ts, 12, 15))
}
}