Class ExtensiblePromise<T>

A safe to extend Promise, as its methods will not use the new class' constructor, but the one of the global Promise object.

Type Parameters

  • T

Hierarchy (view full)

Implements

  • Promise<T>

Constructors

Accessors

Methods

Constructors

Accessors

Methods

  • Attaches a callback for only the rejection of the Promise.

    Type Parameters

    • TF = never

    Parameters

    • Optionalonrejected: null | Callable<unknown, TF | PromiseLike<TF>>

      The callback to execute when the Promise is rejected.

    Returns Promise<T | TF>

    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.

    Parameters

    • Optionalonfinally: null | Callable

      The callback to execute when the Promise is settled (fulfilled or rejected).

    Returns Promise<T>

    A Promise for the completion of the callback.

  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Type Parameters

    • TS = T
    • TF = never

    Parameters

    • Optionalonfulfilled: null | Callable<T, TS | PromiseLike<TS>>

      The callback to execute when the Promise is resolved.

    • Optionalonrejected: null | Callable<unknown, TF | PromiseLike<TF>>

      The callback to execute when the Promise is rejected.

    Returns Promise<TS | TF>

    A Promise for the completion of which ever callback is executed.