@beenotung/tslib
Version:
utils library in Typescript
14 lines (13 loc) • 769 B
TypeScript
export declare class TimeoutError extends Error {
context?: any;
constructor(context?: any);
}
export declare class TimeoutPromise<T> implements Promise<T> {
[Symbol.toStringTag]: any;
private promise;
constructor(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (e?: any) => void) => void, timeout: number, context?: any);
then<R, E>(onfulfilled?: (value: T) => PromiseLike<R> | R, onrejected?: (reason: any) => PromiseLike<E> | E): Promise<R | E>;
catch<TResult>(onrejected?: (reason: any) => PromiseLike<TResult> | TResult): Promise<T | TResult>;
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
}
export declare function timeoutPromise<T>(p: Promise<T>, timeout: number, context?: any): Promise<T>;