import { type Result } from './result.js'; import { type Option } from './option.js'; /** * A Result wrapped in a Promise, with chainable async operations. * * @example * ```ts * const result = ResultAsync.from(fetch('/api/user')) * .map(res => res.json()) * .mapErr(err => new ApiError(err.message)); * ``` */ export declare class ResultAsync { private readonly promise; constructor(promise: Promise>); /** * Create from a Promise that may reject. */ static from(promise: Promise): ResultAsync; /** * Create from a Result. */ static fromResult(result: Result): ResultAsync; /** * Create an Ok ResultAsync. */ static ok(value: T): ResultAsync; /** * Create an Err ResultAsync. */ static err(error: E): ResultAsync; /** Transform the success value. */ map(fn: (value: T) => U): ResultAsync; /** Transform the error value. */ mapErr(fn: (error: E) => F): ResultAsync; /** Chain async operations. */ andThen(fn: (value: T) => ResultAsync): ResultAsync; /** Extract the underlying Promise. */ toPromise(): Promise>; /** Unwrap or throw. */ unwrap(): Promise; /** Unwrap or return default. */ unwrapOr(defaultValue: T): Promise; /** Pattern match on the resolved Result. */ match(handlers: { ok: (value: T) => U; err: (error: E) => U; }): Promise; } /** * An Option wrapped in a Promise. */ export declare class OptionAsync { private readonly promise; constructor(promise: Promise>); /** * Create from a Promise that resolves to a nullable value. */ static from(promise: Promise): OptionAsync; static some(value: T): OptionAsync; static none(): OptionAsync; map(fn: (value: T) => U): OptionAsync; andThen(fn: (value: T) => OptionAsync): OptionAsync; toPromise(): Promise>; unwrap(): Promise; unwrapOr(defaultValue: T): Promise; match(handlers: { some: (value: T) => U; none: () => U; }): Promise; } //# sourceMappingURL=async.d.ts.map