2017-10-04 22:14:05 +02:00
|
|
|
// @skipLibCheck: true
|
2017-06-22 20:56:49 +02:00
|
|
|
// @lib: dom, es7
|
|
|
|
|
|
|
|
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(),
|
2020-03-04 22:19:35 +01:00
|
|
|
]);
|
2017-06-22 20:56:49 +02:00
|
|
|
|
|
|
|
const dataA: A[] = resultA;
|
|
|
|
const dataB: B[] = resultB;
|
|
|
|
if (dataA && dataB) {
|
|
|
|
return dataA.length + dataB.length;
|
|
|
|
}
|
|
|
|
return 0;
|
2019-08-23 21:57:44 +02:00
|
|
|
}
|
2020-03-04 22:19:35 +01:00
|
|
|
|
|
|
|
// #31179
|
|
|
|
|
|
|
|
const expected: Promise<["a", "b", "c"]> = Promise.all(undefined as readonly ["a", "b", "c"]);
|