Skip to content

Commit ec38799

Browse files
committed
Add more tests
1 parent bb87332 commit ec38799

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference3.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,17 @@ declare let g2: <U>(x: Foo2<U> | Bar2<U>) => Promise<U>;
4040

4141
g1 = g2;
4242
g2 = g1;
43+
44+
// Repro from #32572
45+
46+
declare function foo1<T>(obj: string[] & Iterable<T>): T;
47+
declare function foo2<T>(obj: string[] & T): T;
48+
49+
declare let sa: string[];
50+
declare let sx: string[] & { extra: number };
51+
52+
let x1 = foo1(sa); // string
53+
let y1 = foo1(sx); // string
54+
55+
let x2 = foo2(sa); // unknown
56+
let y2 = foo2(sx); // { extra: number }

0 commit comments

Comments
 (0)