← Back to release summary

Promise.any and AggregateError

Category
JavaScript
Type
New or changed feature
Status
Enabled by default (Chrome 85)
Intent stage
Start prototyping

Summary

Promise.any() accepts an iterable of promises and returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError holding the rejection reasons if all of the given promises are rejected. AggregateError is a support class that aggregates one or more errors into a single object.

Motivation

This rounds out standard JS support for commonly available Promise combinators already available in userland libraries.

Standards & signals

Docs: https://v8.dev/features/promise-combinators#promise.any

Explainers: https://v8.dev/features/promise-combinators#promise.any https://github.com/tc39/proposal-promise-any/blob/master/README.md

View on chromestatus.com