UNPKG

399 BTypeScriptView Raw
1/**
2 * Run the function `func` with an `AbortSignal` that will automatically abort after the time specified
3 * by `timeout` or when the given `signal` is aborted.
4 *
5 * On timeout, the `timeoutSignal` will be aborted and a `TimeoutError` will be thrown.
6 */
7export declare function withTimeout<T>(timeout: number, func: (timeoutSignal: AbortSignal) => Promise<T>, signal?: AbortSignal): Promise<T>;