Promise.allSettled S4
- Stage: Stage 4
- Status: Finished
- ECMAScript edition: ES2020
- Synchronized: Aug 28, 2026
- 中文译文 · Source repository
This proposal introduces Promise.allSettled, a combinator that waits for all input promises to settle (fulfill or reject) and returns an array of their state snapshots, without short-circuiting. It addresses the need to handle multiple async operations where complete results are required regardless of individual failures.
The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.
Promise.allSettled
ECMAScript proposal and reference implementation for Promise.allSettled.
Author: Jason Williams (BBC), Robert Pamely (Bloomberg), Mathias Bynens (Google)
Champion: Mathias Bynens (Google)
Stage: 4
Overview and motivation
There are four main combinators in the Promise landscape.
These are all commonly available in userland promise libraries, and they’re all independently useful, each one serving different use cases.
A common use case for this combinator is wanting to take an action after multiple requests have completed, regardless of their success or failure.
Other Promise combinators can short-circuit, discarding the results of input values that lose the race to reach a certain state.
Promise.allSettled is unique in always waiting for all of its input values.
Promise.allSettled returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected.
Why allSettled?
We say that a promise is settled if it is not pending, i.e. if it is either fulfilled or rejected. See promise states and fates for more background on the relevant terminology.
Furthermore, the name allSettled is commonly used in userland libraries implementing this functionality. See below.
Examples
Currently you would need to iterate through the array of promises and return a new value with the status known (either through the resolved branch or the rejected branch.
The proposed API allows a developer to handle these cases without creating a reflect function and/or assigning intermediate results in temporary objects to map through:
Collecting errors example:
Here we are only interested in the promises which failed, and thus collect the reasons. allSettled allows us to do this quite easily.
Real-world scenarios
A common operation is knowing when all requests have completed regardless of the state of each request. This allows developers to build with progressive enhancement in mind. Not all API responses will be mandatory.
Without Promise.allSettled this is tricker than it could be:
Using Promise.allSettled would be more suitable for the operation we wish to perform:
Userland implementations
- https://www.npmjs.com/package/promise.allsettled
- https://www.npmjs.com/package/q
- https://www.npmjs.com/package/rsvp
- http://bluebirdjs.com/docs/api/reflect.html
- https://www.npmjs.com/package/promise-settle
- https://github.com/cujojs/when/blob/master/docs/api.md#whensettle
- https://www.npmjs.com/package/es2015-promise.allsettled
- https://www.npmjs.com/package/promise-all-settled
- https://www.npmjs.com/package/maybe
Naming in other languages
Similar functionality exists in other languages with different names. Since there is no uniform naming mechanism across languages, this proposal follows the naming precedent of userland JavaScript libraries shown above. The following examples were contributed by jasonwilliams and benjamingr.
Rust
futures::join (similar to Promise.allSettled). "Polls multiple futures simultaneously, returning a tuple of all results once complete."
futures::try_join (similar to Promise.all)
C#
Task.WhenAll (similar to ECMAScript Promise.all). You can use either try/catch or TaskContinuationOptions.OnlyOnFaulted to achieve the same behavior as allSettled.
Task.WhenAny (similar to ECMAScript Promise.race)
Python
asyncio.wait using the ALL_COMPLETED option (similar to Promise.allSettled). Returns task objects which are akin to the allSettled inspection results.
Java
allOf (similar to Promise.all)
Dart
Future.wait (similar to ECMAScript Promise.all)
Further reading
- https://www.bennadel.com/blog/3289-implementing-q-s-allsettled-promise-method-in-bluebird.htm
- https://github.com/domenic/promises-unwrapping/blob/master/docs/states-and-fates.md
- http://exploringjs.com/es6/ch_promises.html
- https://github.com/kriskowal/q/issues/257 [naming]
TC39 meeting notes
Specification
Implementations
- V8, shipping in Chrome 76
- SpiderMonkey, shipping in Firefox 68 Nightly
- JavaScriptCore, shipping in Safari TP 85 and Safari 13 Beta
- Chakra
- XS, shipping in v9.0.0
- Spec-compliant polyfill