Type Alias PromiseExecutor<T>

PromiseExecutor<T>: ((resolve: ResolvePromiseHandler<T>, reject: RejectPromiseHandler) => void)

A function to be executed during the creation of a promise instance. It receives two functions as parameters: resolve and reject. Any errors thrown in the executor will cause the promise to be rejected, and the return value will be neglected. The semantics of executor are detailed below.

Type Parameters

  • T

Type declaration

    • (resolve, reject): void
    • Parameters

      • resolve: ResolvePromiseHandler<T>

        The handler function that should be called when the operation has completed and the promise can continue.

      • reject: RejectPromiseHandler

        The handler function that should be called to cause the promise to be rejected.

      Returns void