Can Promise.all() accept an iterable with different resolved types?
For example, can promise.all([promiseA, promiseB, promiseC]) work if promiseA and promiseB return void but promiseC returns boolean?
I attempted this and it seems not possible. I am unsure whether an iterable can have different types, so I wanted to confirm. The error I encountered is related to TypeScript in my code.
PromiseC: Promise<boolean>;
PromiseA: Promise<void>;
PromiseB: Promise<void>;
const promises = [this.promiseA, this.promiseB];
if (!flag) {
promises.push(this.promiseC);
}
Promise.all(promises).then(() => { // do something}
https://i.sstatic.net/cSCw1.png
Thank you for your help!