type Result = { status: "ok"; data: T; } | { status: "error"; error: E; }; declare const Result: { fromThrowing: typeof fromThrowing; fromThrowingAsync: typeof fromThrowingAsync; fromPromise: typeof promiseToResult; ok(data: T): { status: "ok"; data: T; } & { status: "ok"; }; error(error: E): { status: "error"; error: E; } & { status: "error"; }; map: typeof mapResult; or: (result: Result, fallback: U) => T_1 | U; orThrow: (result: Result) => T_2; orThrowAsync: (result: Promise>) => Promise; retry: typeof retry; }; type AsyncResult = Result | ({ status: "pending"; } & { progress: P; }); declare const AsyncResult: { fromThrowing: typeof fromThrowing; fromPromise: typeof promiseToResult; ok: (data: T) => { status: "ok"; data: T; } & { status: "ok"; }; error: (error: E) => { status: "error"; error: E; } & { status: "error"; }; pending: typeof pending; map: typeof mapResult; or: (result: AsyncResult, fallback: U) => T_1 | U; orThrow: (result: AsyncResult) => T_2; retry: typeof retry; }; declare function pending(): AsyncResult & { status: "pending"; }; declare function pending

(progress: P): AsyncResult & { status: "pending"; }; declare function promiseToResult(promise: Promise): Promise>; declare function fromThrowing(fn: () => T): Result; declare function fromThrowingAsync(fn: () => Promise): Promise>; declare function mapResult(result: Result, fn: (data: T) => U): Result; declare function mapResult(result: AsyncResult, fn: (data: T) => U): AsyncResult; declare class RetryError extends AggregateError { readonly errors: unknown[]; constructor(errors: unknown[]); get attempts(): number; } declare function retry(fn: (attemptIndex: number) => Result | Promise>, totalAttempts: number, { exponentialDelayBase }?: { exponentialDelayBase?: number | undefined; }): Promise & { attempts: number; }>; export { AsyncResult, Result };