A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.
Readonly[toOptionalcleanupOptionalrejectOptionalresolveStatic Readonly[species]Attaches a callback for only the rejection of the Promise.
Optionalonrejected: ((reason: any) => TResult | PromiseLike<TResult>) | nullThe callback to execute when the Promise is rejected.
A Promise for the completion of the callback.
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
Optionalonfinally: (() => void) | nullThe callback to execute when the Promise is settled (fulfilled or rejected).
A Promise for the completion of the callback.
Attaches callbacks for the resolution and/or rejection of the Promise.
Optionalonfulfilled: ((value: T) => TResult1 | PromiseLike<TResult1>) | nullThe callback to execute when the Promise is resolved.
Optionalonrejected: ((reason: any) => TResult2 | PromiseLike<TResult2>) | nullThe callback to execute when the Promise is rejected.
A Promise for the completion of which ever callback is executed.
StaticallCreates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
An array of Promises.
A new Promise.
StaticallCreates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.
An array of Promises.
A new Promise.
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.
An array of Promises.
A new Promise.
StaticanyThe any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
An array or iterable of Promises.
A new Promise.
The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
An array or iterable of Promises.
A new Promise.
StaticraceStaticrejectStaticresolveStatictryTakes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result in a Promise.
A function that is called synchronously. It can do anything: either return a value, throw an error, or return a promise.
Additional arguments, that will be passed to the callback.
A Promise that is:
StaticwithCreates a new Promise and returns it in an object, along with its resolve and reject functions.
An object with the properties promise, resolve, and reject.
const { promise, resolve, reject } = Promise.withResolvers<T>();
Creates a new Promise.