Closed
Description
TypeScript Version: 3.7.x-dev.201xxxxx
Search Terms:
Code
async function f<T>(a: T): Promise<T> {
return a;
}
async function g<T>(a: T) {
return a;
}
g(Promise.resolve(0));
Expected behavior:
Return type of f is invalid because the correct type is Promise<awaited T>
.
Return types of g are Promise<awaited T>
and Promise<number>
.
Actual behavior:
Return type of f is valid although the correct type is Promise<awaited T>
.
Return types of g are Promise<T>
and Promise<Promise<number>>
.
Related Issues:
Metadata
Metadata
Assignees
Labels
No labels