mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
Add regression test
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// @strict: true
|
||||
// @target: esnext
|
||||
|
||||
declare const b: boolean;
|
||||
declare const s: string;
|
||||
@@ -51,3 +52,20 @@ foo(x);
|
||||
|
||||
declare function bar<T>(x: T, y: string | T): T;
|
||||
const y = bar(1, 2);
|
||||
|
||||
// Repro from #32752
|
||||
|
||||
const containsPromises: unique symbol = Symbol();
|
||||
|
||||
type DeepPromised<T> =
|
||||
{ [containsPromises]?: true } &
|
||||
{ [TKey in keyof T]: T[TKey] | DeepPromised<T[TKey]> | Promise<DeepPromised<T[TKey]>> };
|
||||
|
||||
async function fun<T>(deepPromised: DeepPromised<T>) {
|
||||
const deepPromisedWithIndexer: DeepPromised<{ [name: string]: {} | null | undefined }> = deepPromised;
|
||||
for (const value of Object.values(deepPromisedWithIndexer)) {
|
||||
const awaitedValue = await value;
|
||||
if (awaitedValue)
|
||||
await fun(awaitedValue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user