UNPKG

769 BTypeScriptView Raw
1export declare class TimeoutError extends Error {
2 context?: any;
3 constructor(context?: any);
4}
5export declare class TimeoutPromise<T> implements Promise<T> {
6 [Symbol.toStringTag]: any;
7 private promise;
8 constructor(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (e?: any) => void) => void, timeout: number, context?: any);
9 then<R, E>(onfulfilled?: (value: T) => PromiseLike<R> | R, onrejected?: (reason: any) => PromiseLike<E> | E): Promise<R | E>;
10 catch<TResult>(onrejected?: (reason: any) => PromiseLike<TResult> | TResult): Promise<T | TResult>;
11 finally(onfinally?: (() => void) | undefined | null): Promise<T>;
12}
13export declare function timeoutPromise<T>(p: Promise<T>, timeout: number, context?: any): Promise<T>;