type Either<TResult, TError = Error> = Success<TResult> | Failure<TError>;
type Success<TResult> = {
    data: TResult;
    error?: undefined;
};
type Failure<TError = Error> = {
    data?: undefined;
    error: TError;
};
export declare function withError(callback: () => never): Failure;
export declare function withError<TResult>(callback: () => Promise<TResult>): Promise<Either<TResult>>;
export declare function withError<TResult>(callback: () => TResult): Either<TResult>;
export {};
