UNPKG

foxts

Version:

Opinionated collection of common TypeScript utils by @SukkaW

15 lines (13 loc) 918 B
declare class LazyPromise<T> extends Promise<T> { private readonly executor; private promise; constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void); static from<T>(this: void, fn: () => T | PromiseLike<T>): LazyPromise<T>; static resolve(this: void): LazyPromise<void>; static resolve<T>(this: void, value: T | PromiseLike<T>): LazyPromise<T>; static reject<T = never>(this: void, reason?: any): LazyPromise<T>; then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>; catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>; finally(onfinally?: (() => void) | null): Promise<T>; } export { LazyPromise };