@@ -163,12 +163,12 @@ declare function foo<T>(x: T | Promise<T>): void;
163
163
>T : Symbol(T, Decl(unionTypeInference.ts, 45, 21))
164
164
>x : Symbol(x, Decl(unionTypeInference.ts, 45, 24))
165
165
>T : Symbol(T, Decl(unionTypeInference.ts, 45, 21))
166
- >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --))
166
+ >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --) )
167
167
>T : Symbol(T, Decl(unionTypeInference.ts, 45, 21))
168
168
169
169
declare let x: false | Promise<true>;
170
170
>x : Symbol(x, Decl(unionTypeInference.ts, 46, 11))
171
- >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --))
171
+ >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --) )
172
172
173
173
foo(x);
174
174
>foo : Symbol(foo, Decl(unionTypeInference.ts, 41, 1))
@@ -187,3 +187,92 @@ const y = bar(1, 2);
187
187
>y : Symbol(y, Decl(unionTypeInference.ts, 50, 5))
188
188
>bar : Symbol(bar, Decl(unionTypeInference.ts, 47, 7))
189
189
190
+ // Repro from #32752
191
+
192
+ const containsPromises: unique symbol = Symbol();
193
+ >containsPromises : Symbol(containsPromises, Decl(unionTypeInference.ts, 54, 5))
194
+ >Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --))
195
+
196
+ type DeepPromised<T> =
197
+ >DeepPromised : Symbol(DeepPromised, Decl(unionTypeInference.ts, 54, 49))
198
+ >T : Symbol(T, Decl(unionTypeInference.ts, 56, 18))
199
+
200
+ { [containsPromises]?: true } &
201
+ >[containsPromises] : Symbol([containsPromises], Decl(unionTypeInference.ts, 57, 5))
202
+ >containsPromises : Symbol(containsPromises, Decl(unionTypeInference.ts, 54, 5))
203
+
204
+ { [TKey in keyof T]: T[TKey] | DeepPromised<T[TKey]> | Promise<DeepPromised<T[TKey]>> };
205
+ >TKey : Symbol(TKey, Decl(unionTypeInference.ts, 58, 7))
206
+ >T : Symbol(T, Decl(unionTypeInference.ts, 56, 18))
207
+ >T : Symbol(T, Decl(unionTypeInference.ts, 56, 18))
208
+ >TKey : Symbol(TKey, Decl(unionTypeInference.ts, 58, 7))
209
+ >DeepPromised : Symbol(DeepPromised, Decl(unionTypeInference.ts, 54, 49))
210
+ >T : Symbol(T, Decl(unionTypeInference.ts, 56, 18))
211
+ >TKey : Symbol(TKey, Decl(unionTypeInference.ts, 58, 7))
212
+ >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
213
+ >DeepPromised : Symbol(DeepPromised, Decl(unionTypeInference.ts, 54, 49))
214
+ >T : Symbol(T, Decl(unionTypeInference.ts, 56, 18))
215
+ >TKey : Symbol(TKey, Decl(unionTypeInference.ts, 58, 7))
216
+
217
+ async function fun<T>(deepPromised: DeepPromised<T>) {
218
+ >fun : Symbol(fun, Decl(unionTypeInference.ts, 58, 92))
219
+ >T : Symbol(T, Decl(unionTypeInference.ts, 60, 19))
220
+ >deepPromised : Symbol(deepPromised, Decl(unionTypeInference.ts, 60, 22))
221
+ >DeepPromised : Symbol(DeepPromised, Decl(unionTypeInference.ts, 54, 49))
222
+ >T : Symbol(T, Decl(unionTypeInference.ts, 60, 19))
223
+
224
+ const deepPromisedWithIndexer: DeepPromised<{ [name: string]: {} | null | undefined }> = deepPromised;
225
+ >deepPromisedWithIndexer : Symbol(deepPromisedWithIndexer, Decl(unionTypeInference.ts, 61, 9))
226
+ >DeepPromised : Symbol(DeepPromised, Decl(unionTypeInference.ts, 54, 49))
227
+ >name : Symbol(name, Decl(unionTypeInference.ts, 61, 51))
228
+ >deepPromised : Symbol(deepPromised, Decl(unionTypeInference.ts, 60, 22))
229
+
230
+ for (const value of Object.values(deepPromisedWithIndexer)) {
231
+ >value : Symbol(value, Decl(unionTypeInference.ts, 62, 14))
232
+ >Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --))
233
+ >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
234
+ >values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --))
235
+ >deepPromisedWithIndexer : Symbol(deepPromisedWithIndexer, Decl(unionTypeInference.ts, 61, 9))
236
+
237
+ const awaitedValue = await value;
238
+ >awaitedValue : Symbol(awaitedValue, Decl(unionTypeInference.ts, 63, 13))
239
+ >value : Symbol(value, Decl(unionTypeInference.ts, 62, 14))
240
+
241
+ if (awaitedValue)
242
+ >awaitedValue : Symbol(awaitedValue, Decl(unionTypeInference.ts, 63, 13))
243
+
244
+ await fun(awaitedValue);
245
+ >fun : Symbol(fun, Decl(unionTypeInference.ts, 58, 92))
246
+ >awaitedValue : Symbol(awaitedValue, Decl(unionTypeInference.ts, 63, 13))
247
+ }
248
+ }
249
+
250
+ // Repro from #32752
251
+
252
+ type Deep<T> = { [K in keyof T]: T[K] | Deep<T[K]> };
253
+ >Deep : Symbol(Deep, Decl(unionTypeInference.ts, 67, 1))
254
+ >T : Symbol(T, Decl(unionTypeInference.ts, 71, 10))
255
+ >K : Symbol(K, Decl(unionTypeInference.ts, 71, 18))
256
+ >T : Symbol(T, Decl(unionTypeInference.ts, 71, 10))
257
+ >T : Symbol(T, Decl(unionTypeInference.ts, 71, 10))
258
+ >K : Symbol(K, Decl(unionTypeInference.ts, 71, 18))
259
+ >Deep : Symbol(Deep, Decl(unionTypeInference.ts, 67, 1))
260
+ >T : Symbol(T, Decl(unionTypeInference.ts, 71, 10))
261
+ >K : Symbol(K, Decl(unionTypeInference.ts, 71, 18))
262
+
263
+ declare function baz<T>(dp: Deep<T>): T;
264
+ >baz : Symbol(baz, Decl(unionTypeInference.ts, 71, 53))
265
+ >T : Symbol(T, Decl(unionTypeInference.ts, 73, 21))
266
+ >dp : Symbol(dp, Decl(unionTypeInference.ts, 73, 24))
267
+ >Deep : Symbol(Deep, Decl(unionTypeInference.ts, 67, 1))
268
+ >T : Symbol(T, Decl(unionTypeInference.ts, 73, 21))
269
+ >T : Symbol(T, Decl(unionTypeInference.ts, 73, 21))
270
+
271
+ declare let xx: { a: string | undefined };
272
+ >xx : Symbol(xx, Decl(unionTypeInference.ts, 74, 11))
273
+ >a : Symbol(a, Decl(unionTypeInference.ts, 74, 17))
274
+
275
+ baz(xx);
276
+ >baz : Symbol(baz, Decl(unionTypeInference.ts, 71, 53))
277
+ >xx : Symbol(xx, Decl(unionTypeInference.ts, 74, 11))
278
+
0 commit comments