export type Result<T, E> = ResultOk<T> | ResultError<E>;
export declare namespace Result {
    function ok<T>(value: T): ResultOk<T>;
    function error<E>(value: E): ResultError<E>;
    function fromString(errorMessage: string): ResultError<Error>;
    function tryWith<T>(f: () => T): Result<T, Error>;
    function tryWithAsync<T>(f: () => Promise<T>): Promise<Result<T, Error>>;
}
/**
 * To instantiate a ResultOk, use `Result.ok(value)`.
 * To instantiate a ResultError, use `Result.error(value)`.
 */
declare class ResultOk<T> {
    readonly val: T;
    constructor(val: T);
    map<U>(f: (value: T) => U): ResultOk<U>;
    mapError<E2>(_f: (error: never) => E2): ResultOk<T>;
    flatMap<U, E2>(f: (value: T) => Result<U, E2>): Result<U, E2>;
    /**
     * Returns the contained ok value.
     * @throws if this is an error (which is impossible for `ResultOk`,
     *   but provided for use on the `Result<T, E>` union type).
     */
    unwrap(): T;
    /**
     * Returns the contained ok value, or the provided default if this
     * is an error.
     */
    unwrapOr(_defaultValue: T): T;
    isOk(): this is ResultOk<T>;
    isError(): this is ResultError<never>;
}
/**
 * To instantiate a ResultOk, use `Result.ok(value)`.
 * To instantiate a ResultError, use `Result.error(value)`.
 */
declare class ResultError<E> {
    readonly err: E;
    constructor(err: E);
    map<U>(_f: (value: never) => U): ResultError<E>;
    mapError<E2>(f: (error: E) => E2): ResultError<E2>;
    flatMap<U, E2>(_f: (value: never) => Result<U, E2>): ResultError<E>;
    /**
     * Always throws since this is an error result.
     * @throws The contained error value (wrapped in Error if not already one).
     */
    unwrap(): never;
    /**
     * Returns the provided default value since this is an error.
     */
    unwrapOr<T>(defaultValue: T): T;
    isOk(): this is ResultOk<never>;
    isError(): this is ResultError<E>;
}
export {};
//# sourceMappingURL=result.d.ts.map