ea521d45e9
* Adds 'Awaited' type alias and updates to Promise.all/race/allSettled/any * Use Awaited<T> with 'await' * Clean up overloads * Further restrict 'Awaited<T>' auto-wrapping for 'await'
20 lines
830 B
Plaintext
20 lines
830 B
Plaintext
tests/cases/compiler/doNotElaborateAssignabilityToTypeParameters.ts(3,3): error TS2322: Type 'Yadda | Awaited<T>' is not assignable to type 'T'.
|
|
'T' could be instantiated with an arbitrary type which could be unrelated to 'Yadda | Awaited<T>'.
|
|
|
|
|
|
==== tests/cases/compiler/doNotElaborateAssignabilityToTypeParameters.ts (1 errors) ====
|
|
async function foo<T>(x: T): Promise<T> {
|
|
let yaddable = await getXOrYadda(x);
|
|
return yaddable;
|
|
~~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'Yadda | Awaited<T>' is not assignable to type 'T'.
|
|
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Yadda | Awaited<T>'.
|
|
}
|
|
|
|
interface Yadda {
|
|
stuff: string,
|
|
things: string,
|
|
}
|
|
|
|
declare function getXOrYadda<T>(x: T): T | Yadda;
|
|
|