import type { Unwrapable } from '../../containers'; import type { Executor, IterValue } from './interface'; /** * implements `Promise` interface but behaves synchronously if possible * * @example * console.log(1); * SyncPromise.resolve(2).then(console.log) * SyncPromise.resolve(SyncPromise.resolve(3)).then(console.log) * console.log(4); * * // the output will be: 1, 2, 3, 4 */ export declare class SyncPromise implements Omit, 'unwrapOr'> { #private; [Symbol.toStringTag]: string; constructor(executor: Executor); /** * determines if current status is 'rejected' */ get isRejected(): boolean; /** * @see {@link Promise.resolve} */ static resolve(value: PromiseLike | R): SyncPromise; /** * @see {@link Promise.reject} */ static reject(err: any): SyncPromise; /** * @see {@link Promise.all} */ static all>(iterable: I): SyncPromise[]>; /** * @see {@link Promise.any} */ static any>(iterable: I): SyncPromise>; /** * @see {@link Promise.allSettled} */ static allSettled>(iterable: I): SyncPromise>[]>; /** * @see {@link Promise.race} */ static race>(iterable: I): SyncPromise>; /** * @see {@link Promise.then} */ then(onFullfill?: Nullable<(value: T) => PromiseLike | R1>): SyncPromise; /** * @see {@link Promise.then} */ then(onFullfill: Nullable<(value: T) => PromiseLike | R1>, onReject?: Nullable<(err: any) => PromiseLike | R2>): SyncPromise; /** * @see {@link Promise.catch} */ catch(onReject?: Nullable<(err: any) => PromiseLike | R>): SyncPromise; /** * @see {@link Promise.finally} */ finally(cb: VoidFunction): SyncPromise; /** * returns current value if "status" is not "pending" * and throws an error otherwise */ unwrap(): T | never; }