1
1
=== tests/cases/compiler/genericCapturingFunctionNarrowing.ts ===
2
- function needsToNarrowTheType<First extends { foo: string }, Second extends { bar: string }>(thing: First | Second) {
2
+ function needsToNarrowTheType<First extends { foo: string }, Second extends { bar: string }, SubFirst extends First, SubFirstMore extends First & {other: string} >(thing: First | SubFirst | SubFirstMore | Second) {
3
3
>needsToNarrowTheType : Symbol(needsToNarrowTheType, Decl(genericCapturingFunctionNarrowing.ts, 0, 0))
4
4
>First : Symbol(First, Decl(genericCapturingFunctionNarrowing.ts, 0, 30))
5
5
>foo : Symbol(foo, Decl(genericCapturingFunctionNarrowing.ts, 0, 45))
6
6
>Second : Symbol(Second, Decl(genericCapturingFunctionNarrowing.ts, 0, 60))
7
7
>bar : Symbol(bar, Decl(genericCapturingFunctionNarrowing.ts, 0, 77))
8
- >thing : Symbol(thing , Decl(genericCapturingFunctionNarrowing.ts, 0, 93 ))
8
+ >SubFirst : Symbol(SubFirst , Decl(genericCapturingFunctionNarrowing.ts, 0, 92 ))
9
9
>First : Symbol(First, Decl(genericCapturingFunctionNarrowing.ts, 0, 30))
10
+ >SubFirstMore : Symbol(SubFirstMore, Decl(genericCapturingFunctionNarrowing.ts, 0, 116))
11
+ >First : Symbol(First, Decl(genericCapturingFunctionNarrowing.ts, 0, 30))
12
+ >other : Symbol(other, Decl(genericCapturingFunctionNarrowing.ts, 0, 147))
13
+ >thing : Symbol(thing, Decl(genericCapturingFunctionNarrowing.ts, 0, 163))
14
+ >First : Symbol(First, Decl(genericCapturingFunctionNarrowing.ts, 0, 30))
15
+ >SubFirst : Symbol(SubFirst, Decl(genericCapturingFunctionNarrowing.ts, 0, 92))
16
+ >SubFirstMore : Symbol(SubFirstMore, Decl(genericCapturingFunctionNarrowing.ts, 0, 116))
10
17
>Second : Symbol(Second, Decl(genericCapturingFunctionNarrowing.ts, 0, 60))
11
18
12
19
if (hasAFoo(thing)) {
13
20
>hasAFoo : Symbol(hasAFoo, Decl(genericCapturingFunctionNarrowing.ts, 7, 5))
14
- >thing : Symbol(thing, Decl(genericCapturingFunctionNarrowing.ts, 0, 93 ))
21
+ >thing : Symbol(thing, Decl(genericCapturingFunctionNarrowing.ts, 0, 163 ))
15
22
16
23
console.log(thing.foo);
17
24
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
18
25
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
19
26
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
20
27
>thing.foo : Symbol(foo, Decl(genericCapturingFunctionNarrowing.ts, 0, 45))
21
- >thing : Symbol(thing, Decl(genericCapturingFunctionNarrowing.ts, 0, 93 ))
28
+ >thing : Symbol(thing, Decl(genericCapturingFunctionNarrowing.ts, 0, 163 ))
22
29
>foo : Symbol(foo, Decl(genericCapturingFunctionNarrowing.ts, 0, 45))
23
30
}
24
31
else {
@@ -28,7 +35,7 @@ function needsToNarrowTheType<First extends { foo: string }, Second extends { ba
28
35
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
29
36
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
30
37
>thing.bar : Symbol(bar, Decl(genericCapturingFunctionNarrowing.ts, 0, 77))
31
- >thing : Symbol(thing, Decl(genericCapturingFunctionNarrowing.ts, 0, 93 ))
38
+ >thing : Symbol(thing, Decl(genericCapturingFunctionNarrowing.ts, 0, 163 ))
32
39
>bar : Symbol(bar, Decl(genericCapturingFunctionNarrowing.ts, 0, 77))
33
40
}
34
41
0 commit comments