import type { ConstructorType } from '@thalesrc/extra-ts-types'; type Executor = ConstructorParameters>>[0]; type ExecutorParams = Parameters>; type Resolver = ExecutorParams[0]; type Rejector = ExecutorParams[1]; /** * #### Open Promise * A promise constructor to resolve or reject from outside * * * * * * Example: * ```typescript * import { OpenPromise } from "@thalesrc/js-utils"; * * const aPromiseWillBeResolvedLater = new OpenPromise(); * * aPromiseWillBeResolvedLater.then(val => console.log(val)); * // aPromiseWillBeResolvedLater.finished // false * ... * ... * * aPromiseWillBeResolvedLater.resolve({x: 1}); * // aPromiseWillBeResolvedLater.finished // true * ``` * * * * * @template T typeof the value which is going to be resolved */ export declare class OpenPromise extends Promise { #private; /** * Returns whether is the promise resolved */ get resolved(): boolean; /** * Returns whether is the promise rejected */ get rejected(): boolean; /** * Returns whether is the promise finished */ get finished(): boolean; /** * Open Promise Constructor */ constructor(executor?: Executor); /** * Resolves promise * @param value Value to resolve the promise */ resolve(...args: Parameters>): void; /** * Rejects promise * @param reason Error to reject promise */ reject(...args: Parameters): void; /** * Binds a promise to the inner promise to resolve or reject with it * @param promise A promise to bind inner promise */ bindTo(promise: Promise): void; } export {};