Function waitUntilTimeout

  • Race a promise against an idle timeout. If the promise does not settle within timeoutMs milliseconds, the returned promise rejects with IdleTimeoutError (or the error returned by throwError when provided). The timer is properly cleaned up on settlement to avoid leaking handles.

    Type Parameters

    Parameters

    • promise: Promise<T>
    • timeoutMs: number
    • Optional throwError: (() => E)
        • (): E
        • Returns E

    Returns Promise<Throws<T, E | IdleTimeoutError>>