UNPKG

@creately/future

Version:

Extended version of the Promise class which has `resolve` and `reject` methods to resolve or reject the underlying promise.

12 lines (11 loc) 325 B
/** * Future extends Promise and exposes the resolve and reject methods. */ export declare type Future<T> = Promise<T> & { resolve: (val: T) => void; reject: (err: Error) => void; }; /** * Creates a new Future instance by extending a new Promise instance. */ export declare function createFuture<T>(): Future<T>;