TypeScript/tests/baselines/reference/promiseAllOnAny01.types
Daniel Rosenwasser f494742ce9
Check for array types when instantiating mapped type constraints with any (#46218)
* Added/updated tests.

* Accepted baselines.

* Update test.

* Update instantiateMappedType to work specially when 'any' replaced an array.

* Accepted baselines.

* Ensure check works when constraint is a union of arrayish types, just like in `Promise.all`.

* Accepted baselines.

* Update test for indirect instantiation of a mapped type.

* Accepted baselines.

* Update test comment.

* Accepted baselines.

* Added tuple test case.

* Accepted baselines.

* Don't add special behavior for tuples.

* Accepted baselines.

* Revert "Don't add special behavior for tuples."

This reverts commit f01ae16e65.

* Accepted baselines.
2021-10-27 15:03:01 -07:00

22 lines
622 B
Plaintext

=== tests/cases/compiler/promiseAllOnAny01.ts ===
async function foo(x: any) {
>foo : (x: any) => Promise<any[]>
>x : any
let abc = await Promise.all(x);
>abc : any[]
>await Promise.all(x) : any[]
>Promise.all(x) : Promise<any[]>
>Promise.all : <T extends readonly unknown[] | []>(values: T) => Promise<{ -readonly [P in keyof T]: Awaited<T[P]>; }>
>Promise : PromiseConstructor
>all : <T extends readonly unknown[] | []>(values: T) => Promise<{ -readonly [P in keyof T]: Awaited<T[P]>; }>
>x : any
let result: any[] = abc;
>result : any[]
>abc : any[]
return result;
>result : any[]
}