@@ -161,3 +161,47 @@ g2 = g1;
161
161
>g2 : Symbol(g2, Decl(unionAndIntersectionInference3.ts, 35, 11))
162
162
>g1 : Symbol(g1, Decl(unionAndIntersectionInference3.ts, 34, 11))
163
163
164
+ // Repro from #32572
165
+
166
+ declare function foo1<T>(obj: string[] & Iterable<T>): T;
167
+ >foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8))
168
+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22))
169
+ >obj : Symbol(obj, Decl(unionAndIntersectionInference3.ts, 42, 25))
170
+ >Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --))
171
+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22))
172
+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22))
173
+
174
+ declare function foo2<T>(obj: string[] & T): T;
175
+ >foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57))
176
+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22))
177
+ >obj : Symbol(obj, Decl(unionAndIntersectionInference3.ts, 43, 25))
178
+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22))
179
+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22))
180
+
181
+ declare let sa: string[];
182
+ >sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11))
183
+
184
+ declare let sx: string[] & { extra: number };
185
+ >sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11))
186
+ >extra : Symbol(extra, Decl(unionAndIntersectionInference3.ts, 46, 28))
187
+
188
+ let x1 = foo1(sa); // string
189
+ >x1 : Symbol(x1, Decl(unionAndIntersectionInference3.ts, 48, 3))
190
+ >foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8))
191
+ >sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11))
192
+
193
+ let y1 = foo1(sx); // string
194
+ >y1 : Symbol(y1, Decl(unionAndIntersectionInference3.ts, 49, 3))
195
+ >foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8))
196
+ >sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11))
197
+
198
+ let x2 = foo2(sa); // unknown
199
+ >x2 : Symbol(x2, Decl(unionAndIntersectionInference3.ts, 51, 3))
200
+ >foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57))
201
+ >sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11))
202
+
203
+ let y2 = foo2(sx); // { extra: number }
204
+ >y2 : Symbol(y2, Decl(unionAndIntersectionInference3.ts, 52, 3))
205
+ >foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57))
206
+ >sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11))
207
+
0 commit comments