//#region src/common/exec/promise.d.ts /** * Promise to be used with `await`. Example: * * ``` * const [promise, resolve, reject] = createPromise() * setTimeout(() => { * resolve(5) * }, 50) * const result = await promise * ``` */ declare function createPromise(): [Promise, any, any]; /** Sleep for `milliSeconds`. Example 1s: `await sleep(1000)` */ declare function sleep(milliSeconds: number): Promise; /** Same as `await sleep(0)`, just let the event loop execute. */ declare function immediate(): Promise; declare function timeout(promise: Promise, milliSeconds: number, timeoutValue?: string): Promise; declare function isTimeout(value: any): boolean; declare function tryTimeout(promise: Promise, milliSeconds: number): Promise; /** * @deprecated use emitter.waitOn * Wait for `event` on `obj` to emit. Resolve with result or reject on `timeout` */ declare function waitOn(obj: any, event: string, timeoutMS?: number): Promise; declare function isPromise(value: Promise | T): value is Promise; /** This is exactly what Prose.resolve(x) is supposed to be: return a Promise no matter what type x is */ declare function promisify(value: Promise | T): Promise; /** * Like ReturnType but for async functions. * From https://www.jpwilliams.dev/how-to-unpack-the-return-type-of-a-promise-in-typescript */ type AsyncReturnType any> = T extends ((...args: any) => Promise) ? U : T extends ((...args: any) => infer U) ? U : any; //#endregion export { isTimeout as a, timeout as c, isPromise as i, tryTimeout as l, createPromise as n, promisify as o, immediate as r, sleep as s, AsyncReturnType as t, waitOn as u }; //# sourceMappingURL=promise-CU_CENbU.d.cts.map