The Promise.resolve()
method returns a Promise
object that is resolved with the given value. It can be used to convert “promise-like” objects to native Promise
objects: If you pass a thenable (an object with a then()
method) to Promise.resolve()
, the returned Promise
object will eventually adopt the same state.
Note that Promise.resolve()
doesn't necessarily return a fulfilled promise. If it receives a thenable that ends up being rejected, the returned Promise
object will be rejected as well. Check out States and Fates for a more detailed explanation.