Posted By: Anonymous
If I have an async-function which contains an explicit return statement which returns a Promise, what will be the value of an await expression calling such a function?
Does the await resolve to the value given by the explicit return-expression of the async-function, or does it resolve to what that value resolves to in case it is a Promise?
I know there are already questions related to this topic on Stack Overflow, but I would just like a precise answer to this question: "Is it possible for an ‘await’ to resolve to a Promise?". Yes or No? Of course if you can also explain why or why not, that would be very helpful.
No, it’s impossible for an
await expression to result in a promise.
Just like you cannot fulfill a promise with another promise, and like
then() never calling the fulfillment handler with a promise.