Optionalvalue: ValueType | PromiseLike<ValueType>Optionalreason: unknownReadonlyisWhether the promise is canceled.
Cancel the promise and optionally provide a reason.
The cancellation is synchronous. Calling it after the promise has settled or multiple times does nothing.
Optionalreason: stringThe cancellation reason to reject the promise with.
Readonly[toStatic Readonly[species]StaticfnConvenience method to make your promise-returning or async function cancelable.
Rest...arguments: unknown[]Rest...arguments: unknown[]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 iterable of Promises.
A new Promise.
Creates 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.
StaticraceCreates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
An iterable of Promises.
A new Promise.
Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
An array of Promises.
A new Promise.
StaticrejectStaticresolveCreates a new resolved promise.
A resolved promise.
Creates a new resolved promise for the provided value.
A promise.
A promise whose internal state matches the provided promise.
Creates a new resolved promise for the provided value.
A promise.
A promise whose internal state matches the provided promise.
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
Optionalonfinally: null | (() => void)The callback to execute when the Promise is settled (fulfilled or rejected).
A Promise for the completion of the callback.
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.
Attaches callbacks for the resolution and/or rejection of the Promise.
Optionalonfulfilled: null | ((value: ValueType) => TResult1 | PromiseLike<TResult1>)The callback to execute when the Promise is resolved.
Optionalonrejected: null | ((reason: any) => TResult2 | PromiseLike<TResult2>)The callback to execute when the Promise is rejected.
A Promise for the completion of which ever callback is executed.
Attaches a callback for only the rejection of the Promise.
Optionalonrejected: null | ((reason: any) => TResult | PromiseLike<TResult>)The callback to execute when the Promise is rejected.
A Promise for the completion of the callback.
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>();
Create a promise that can be canceled.
Can be constructed in the same was as a
Promiseconstructor, but with an appendedonCancelparameter inexecutor.PCancelableis a subclass ofPromise.Cancelling will reject the promise with
CancelError. To avoid that, setonCancel.shouldRejecttofalse.