Type parameters

  • T

Hierarchy

  • Promise

Index

Constructors

Methods

Constructors

constructor

  • new Promise(executor: function): Promise
  • Parameters

    • executor: function
        • (resolve: function, reject: function): void
        • Parameters

          • resolve: function
              • (value: T | PromiseLike<T>): void
              • Parameters

                • value: T | PromiseLike<T>

                Returns void

          • reject: function
              • (reason: any): void
              • Parameters

                • reason: any

                Returns void

          Returns void

    Returns Promise

Methods

then

  • then<TResult1, TResult2>(onfulfilled?: function | null, onrejected?: function | null): Promise<TResult1 | TResult2>
  • Type parameters

    • TResult1

    • TResult2

    Parameters

    • Optional onfulfilled: function | null
    • Optional onrejected: function | null

    Returns Promise<TResult1 | TResult2>

Static as

  • as(value: null): Promise<null>
  • as(value: undefined): Promise<undefined>
  • as<T>(value: PromiseLike<T>): PromiseLike<T>
  • as<T, SomePromise>(value: SomePromise): SomePromise
  • as<T>(value: T): Promise<T>
  • Parameters

    • value: null

    Returns Promise<null>

  • Parameters

    • value: undefined

    Returns Promise<undefined>

  • Type parameters

    • T

    Parameters

    • value: PromiseLike<T>

    Returns PromiseLike<T>

  • Type parameters

    • T

    • SomePromise: PromiseLike<T>

    Parameters

    • value: SomePromise

    Returns SomePromise

  • Type parameters

    • T

    Parameters

    • value: T

    Returns Promise<T>

Static join

  • join<T1, T2>(promises: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>
  • join<T>(promises: (T | PromiseLike<T>)[]): Promise<T[]>
  • Type parameters

    • T1

    • T2

    Parameters

    • promises: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]

    Returns Promise<[T1, T2]>

  • Type parameters

    • T

    Parameters

    • promises: (T | PromiseLike<T>)[]

    Returns Promise<T[]>

Static wrap

  • wrap<T>(value: T | PromiseLike<T>): Promise<T>

Static wrapError

  • wrapError<T>(error: Error): Promise<T>