Function timeout

  • Category

    Reject if the given promise does not resolve within the given timeout.

    Time complexity: O(1)

    Space complexity: O(1)

    Type Parameters

    • T

    Parameters

    • promise: PromiseLike<T>

      The promise to wait for

    • timeoutMs: number

      The timeout in milliseconds

    Returns Promise<T>

    The resolved value of the promise

    Promise