interface IResult { /** Returns `true` if this result represents an `Ok variant. */ isOk(): this is Ok; /** Returns `true` if this result represents an `Err` variant. */ isErr(): this is Err; /** Maps `Ok` variant and propagates `Err` variant. */ map(f: (t: T) => U): Result; /** Maps `Err` variant and propagates `Ok` variant. */ mapErr(f: (e: E) => U): Result; /** Fallibly maps `Ok` variant and propagates `Err` variant. */ andThen(f: (t: T) => Result): Result; /** Calls `ok` if `this` is `Ok` variant and `err` if `this` is `Err` variant. */ match(ok: (t: T) => U, err: (e: E) => U): U; /** Unwraps `Ok` variant and throws on `Err` variant. */ unwrap(): T; } interface IAsyncResult { /** Maps `Ok` variant asynchronously and propagates `Err` variant. */ mapAsync(f: (t: T) => Promise): Promise>; /** Maps `Err` variant asynchronously and propagates `Ok` variant. */ mapErrAsync(f: (t: E) => Promise): Promise>; /** Fallibly maps `Ok` variant asynchronously and propagates `Err` variant. */ andThenAsync(f: (t: T) => Promise>): Promise>; } export declare class Ok implements IResult, IAsyncResult { readonly value: T; constructor(value: T); isOk(): this is Ok; isErr(): this is Err; map(f: (t: T) => U): Result; mapErr(_: (e: E) => U): Result; andThen(f: (t: T) => Result): Result; match(ok: (t: T) => U, _: (e: E) => U): U; unwrap(): T; mapAsync(f: (t: T) => Promise): Promise>; mapErrAsync(_: (t: E) => Promise): Promise>; andThenAsync(f: (t: T) => Promise>): Promise>; } export declare class Err implements IResult, IAsyncResult { readonly error: E; constructor(error: E); isOk(): this is Ok; isErr(): this is Err; map(_: (t: T) => U): Result; mapErr(f: (e: E) => U): Result; andThen(_: (t: T) => Result): Result; match(_: (t: T) => U, err: (e: E) => U): U; unwrap(): T; mapAsync(_: (t: T) => Promise): Promise>; mapErrAsync(f: (t: E) => Promise): Promise>; andThenAsync(_: (t: T) => Promise>): Promise>; } export declare type Result = Ok | Err; export declare const ok: (value: T) => Ok; export declare const err: (err: E) => Err; export {};