Skip to content

Commit 4ae0848

Browse files
committed
Add tests
1 parent 2f7cf9e commit 4ae0848

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// @strict: true
2+
3+
// Repro from #28862
4+
5+
type Foo<A> = { type: "foo", (): A[] };
6+
type Bar<A> = { type: "bar", (): A };
7+
8+
type FooBar<A> = Foo<A> | Bar<A>;
9+
10+
type InferA<T> = T extends FooBar<infer A> ? A : never;
11+
12+
type FooA = InferA<Foo<number>>; // number
13+
14+
// Repro from #28862
15+
16+
type Item<T> = { kind: 'a', data: T } | { kind: 'b', data: T[] };
17+
18+
declare function foo<T>(item: Item<T>): T;
19+
20+
let x1 = foo({ kind: 'a', data: 42 }); // number
21+
let x2 = foo({ kind: 'b', data: [1, 2] }); // number

0 commit comments

Comments
 (0)