@ablestack/deferred-promise-ts
Version:
A tiny library, containing a strongly typed deferred-promise class, that leverages ES6 promises and implements the Promise<T> interface
13 lines (12 loc) • 695 B
TypeScript
export declare class DeferredPromise<T> implements Promise<T> {
private _resolveSelf;
private _rejectSelf;
private promise;
constructor();
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
finally(onfinally?: (() => void) | null): Promise<T>;
resolve(val: T): void;
reject(reason: any): void;
[Symbol.toStringTag]: 'Promise';
}