@@ -163,12 +163,12 @@ declare function foo<T>(x: T | Promise<T>): void;
163163>T : Symbol(T, Decl(unionTypeInference.ts, 45, 21))
164164>x : Symbol(x, Decl(unionTypeInference.ts, 45, 24))
165165>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, --, --) )
167167>T : Symbol(T, Decl(unionTypeInference.ts, 45, 21))
168168
169169declare let x: false | Promise<true>;
170170>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, --, --) )
172172
173173foo(x);
174174>foo : Symbol(foo, Decl(unionTypeInference.ts, 41, 1))
@@ -187,3 +187,63 @@ const y = bar(1, 2);
187187>y : Symbol(y, Decl(unionTypeInference.ts, 50, 5))
188188>bar : Symbol(bar, Decl(unionTypeInference.ts, 47, 7))
189189
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+
0 commit comments