Closed
Description
TypeScript Version: 3.8.0-dev.20200115
Search Terms: Promise.all
Code
interface A {
id: string
}
interface B {
id: string
fieldB: string
}
async function countEverything(): Promise<number> {
const providerA = async (): Promise<A[]> => { return [] }
const providerB = async (): Promise<B[]> => { return [] }
const [resultA, resultB] = await Promise.all([
providerA(),
providerB(),
]);
const dataA: A[] = resultA;
const dataB: B[] = resultB;
if (dataA && dataB) {
return dataA.length + dataB.length;
}
return 0;
}
Expected behavior:
Compiles without errors.
Actual behavior:
Compile fails.
Type 'A[]' is not assignable to type 'B[]'.
Property 'fieldB' is missing in type 'A' but required in type 'B'.(2322)
input.ts(7, 5): 'fieldB' is declared here.
Playground Link: Playground Link
Related Issues: #16017
This appears to be the exact same issue as #16017, just reappearing in version 3.7+.