UNPKG

@consolidados/results

Version:
28 lines (25 loc) 1.05 kB
import { E as Err$1, O as Ok$1 } from '../err-B7LUEZ0f.cjs'; export { R as Result } from '../err-B7LUEZ0f.cjs'; /** * Creates a new `Ok` instance, representing a successful result. * @template T The type of the value contained in the `Ok`. * @param value The value to wrap in the `Ok` instance. * @returns An `Ok` instance containing the given value. * @example * const result = Ok(42); * console.log(result.isOk()); // true * console.log(result.unwrap()); // 42 */ declare function Ok<T>(value: T): Ok$1<T>; /** * Creates a new `Err` instance, representing a failed result. * @template E The type of the error contained in the `Err`. * @param error The error to wrap in the `Err` instance. * @returns An `Err` instance containing the given error. * @example * const result = Err("Something went wrong"); * console.log(result.isErr()); // true * console.log(result.unwrapErr()); // "Something went wrong" */ declare function Err<E extends Error>(error: E | string): Err$1<E>; export { Err, Err$1 as ErrType, Ok, Ok$1 as OkType };