I want to pass Promise.all directly to the .then function, for example:
const test = [ Promise.resolve(), Promise.resolve(), Promise.resolve(), Promise.resolve() ]; Promise.resolve(test)
But this code raises an Uncaught (in promise) TypeError: Promise.all called on non-object .
When I remove the shorthand syntax, it works:
Promise.resolve(test) .then(queries => Promise.all(queries)) .then(console.log('End'));
So why does a Promise.all passed directly to .then Promise.all error? (And why does a console.log work fine?)
source share