A resolved promise is one whose resolve or reject function has been called. That does not necessarily mean it is fulfilled or rejected: resolving with another promise or thenable makes it adopt that value’s state, which may still be pending. section 8.1.1
Keep these distinctions in mind:
- Settled means fulfilled or rejected. A promise resolved with a thenable can remain unsettled. section 8.1.1
- Once resolved, later calls to resolve or reject are ignored—even if the adopted thenable has not settled. section 8.1.1
- People sometimes use “resolved” colloquially to mean settled or fulfilled; the terms are not interchangeable here. section 8.1.1
Listing 8.2 Resolving promises with other promises
const fulfilledPromise = Promise.resolve("fulfilled"); #A
const rejectedPromise = Promise.reject(new Error("rejected")); #A
const promise1 = new Promise((resolve) => resolve(fulfilledPromise));
const promise2 = new Promise((resolve) => resolve(rejectedPromise));
promise1.then((value) => { #B
console.log(`promise1 was fulfilled with value "${value}"`); #B
}); #B
promise2.then(undefined, (reason) => { #C
console.log(`promise2 was rejected with reason "${reason}"`); #C
}); #C
Compare how resolving with fulfilled and rejected promises makes each new promise adopt the corresponding outcome. section 8.1.1
