type ResolveFn = (value?: T | PromiseLike) => void; type RejectFn = (reason?: any) => void; export declare class SyncPromise implements PromiseLike { private state; private value; private handlers; constructor(executor: (resolve: ResolveFn, reject: RejectFn) => void); private _resolve; private _reject; private _executeHandlers; then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): SyncPromise; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null): SyncPromise; finally(onfinally?: (() => void) | null): SyncPromise; static resolve(value?: T | PromiseLike): SyncPromise; static reject(reason?: any): SyncPromise; static all(promises: (T | PromiseLike)[]): SyncPromise; static allSettled(promises: (T | PromiseLike)[]): SyncPromise<{ status: "fulfilled" | "rejected"; value?: T; reason?: any; }[]>; static race(promises: (T | PromiseLike)[]): SyncPromise; } type SettledPromProps = { settled: boolean; onSettled: Promise; res: (t: T) => void; rej: (err: any) => void; }; type ResablePromProps = { res: (t: T) => void; rej: (err: any) => void; }; type CancelAblePromProps = { cancel: (reason: C) => CT; cancelled: boolean; onCancel: Promise<{ reason: C; cancelResult: CT; }>; }; interface SettledPromiseConstructor { new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void): SettledPromise; prototype: SettledPromise; } export declare const SettledPromise: SettledPromiseConstructor; export type SettledPromise = SettledPromProps & { then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): SettledPromise; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): SettledPromise; finally(onfinally?: (() => void) | undefined | null): SettledPromise; } & Promise; export type ResablePromise = SettledPromProps & ResablePromProps & { then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): ResablePromise; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): ResablePromise; finally(onfinally?: (() => void) | undefined | null): ResablePromise; } & Promise; interface ResablePromiseConstructor { new (executor?: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void): ResablePromise; prototype: ResablePromise; } export declare const ResablePromise: ResablePromiseConstructor; export type CancelFunc = (reason: C) => CT; export type CancelAblePromise = SettledPromProps & ResablePromProps & CancelAblePromProps & { then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null, onCancelForward?: true): CancelAblePromise; then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null, onCancel?: (reason: newC) => newCT): CancelAblePromise; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): CancelAblePromise; finally(onfinally?: (() => void) | undefined | null): CancelAblePromise; } & Promise; interface CancelAblePromiseConstructor { new (executor?: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => (CancelFunc | any), cancel?: (reason: C) => void): CancelAblePromise; prototype: CancelAblePromise; } export declare const CancelAblePromise: CancelAblePromiseConstructor; export type SettledSyncPromise = SettledPromProps & { then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): SettledSyncPromise; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): SettledSyncPromise; finally(onfinally?: (() => void) | undefined | null): SettledSyncPromise; } & SyncPromise; interface SettledSyncPromiseConstructor { new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void): SettledSyncPromise; prototype: SettledSyncPromise; } export declare const SettledSyncPromise: SettledSyncPromiseConstructor; export type ResableSyncPromise = SettledPromProps & ResablePromProps & { then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): ResableSyncPromise; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): ResableSyncPromise; finally(onfinally?: (() => void) | undefined | null): ResableSyncPromise; } & SyncPromise; interface ResableSyncPromiseConstructor { new (executor?: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void): ResableSyncPromise; prototype: ResableSyncPromise; } export declare const ResableSyncPromise: ResableSyncPromiseConstructor; export type CancelAbleSyncPromise = SettledPromProps & ResablePromProps & CancelAblePromProps & { then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null, onCancelForward?: true): CancelAblePromise; then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null, onCancel?: (reason: newC) => newCT): CancelAbleSyncPromise; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): CancelAbleSyncPromise; finally(onfinally?: (() => void) | undefined | null): CancelAbleSyncPromise; } & SyncPromise; interface CancelAbleSyncPromiseConstructor { new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => (CancelFunc | any), cancel?: (reason: C) => void): CancelAbleSyncPromise; prototype: CancelAbleSyncPromise; } export declare const CancelAbleSyncPromise: CancelAbleSyncPromiseConstructor; export {};