Why this code produce errors?
let promises = [p1(), p2(), p3()];
$q.all(promises)
.then(([p1Result, p2Result, p3Result]) => {
// ...
});
But when I turn it to this, it works:
let promises = [p1(), p2(), p3()];
$q.all(promises)
.then(results => {
let [p1Result, p2Result, p3Result] = results;
// ...
});
Another problem I have is that I can't define a type for p1Result, p2Result, p3Result. Not to mention that Typescript compiler does not infer types of them.
[p1Result, p2Result, p3Result]:[p1Type, p2Type, p3Type]or evenresults:[p1Type, p2Type, p3Type]. What is the error you see?