-
Notifications
You must be signed in to change notification settings - Fork 13k
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 3.7.0-beta
Search Terms:
promise all
Code
interface A {
a: string
}
interface B {
b: string
}
async function main(): Promise<A> {
const [a, b] = await Promise.all([
Promise.resolve({a: "a"} as A),
Promise.resolve({b: "b"} as B | undefined), // <- the `| undefined` here is the problem
]);
return a; // <- a has type `A | undefined`, but should be `A`
}
Expected behavior:
This is a regression from 3.6.3, where the return tuple of Promise.all
is correctly inferred.
Actual behavior:
A | undefined
bound of a different tuple member also adds a | undefined
bound on a different unrelated return value of Promise.all
.
Playground Link:
Related Issues:
Maybe #33707 ?
mcous, Zarel, shawnmcknight, anton-bot, oleg-codaio and 43 morehughns, lambda-fairy, andrevmatos, brainkim, kohlmannj and 4 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue