/** * A deconstructed Promise exposing its `resolve` and `reject` functions alongside the Promise itself. * Useful for controlling Promise resolution from outside the executor. */ export type PromiseReference = { readonly promise: Promise; readonly resolve: (value: O | PromiseLike) => void; readonly reject: (reason?: unknown) => void; }; /** * An executor function for a Promise, matching the signature of the native Promise constructor callback. * * @param resolve - Resolves the Promise with a value. * @param reject - Rejects the Promise with a reason. */ export type PromiseExecutor = (resolve: (value: O | PromiseLike) => void, reject: (reason?: unknown) => void) => void; /** * Creates a new {@link PromiseReference} containing a Promise and its externally accessible * `resolve` and `reject` functions. An optional executor can be provided to run initialization * logic inside the Promise constructor. * * @param executor - An optional executor function invoked inside the Promise constructor. * @returns A PromiseReference with the created Promise and its control functions. */ export declare function promiseReference(executor?: PromiseExecutor): PromiseReference;