Skip to content

Commit f929a25

Browse files
committed
Add regression test
1 parent a81ce06 commit f929a25

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

+18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @strict: true
2+
// @target: esnext
23

34
declare const b: boolean;
45
declare const s: string;
@@ -51,3 +52,20 @@ foo(x);
5152

5253
declare function bar<T>(x: T, y: string | T): T;
5354
const y = bar(1, 2);
55+
56+
// Repro from #32752
57+
58+
const containsPromises: unique symbol = Symbol();
59+
60+
type DeepPromised<T> =
61+
{ [containsPromises]?: true } &
62+
{ [TKey in keyof T]: T[TKey] | DeepPromised<T[TKey]> | Promise<DeepPromised<T[TKey]>> };
63+
64+
async function fun<T>(deepPromised: DeepPromised<T>) {
65+
const deepPromisedWithIndexer: DeepPromised<{ [name: string]: {} | null | undefined }> = deepPromised;
66+
for (const value of Object.values(deepPromisedWithIndexer)) {
67+
const awaitedValue = await value;
68+
if (awaitedValue)
69+
await fun(awaitedValue);
70+
}
71+
}

0 commit comments

Comments
 (0)