@consolidados/results
Version:
Result types, ease and simple
21 lines (18 loc) • 709 B
TypeScript
import { E as Err$1, a as Ok$1 } from '../option-B_KKIecf.js';
export { R as Result } from '../option-B_KKIecf.js';
/**
* 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 an Err - strings are converted to Error, everything else preserved
*/
declare function Err<E>(error: E): Err$1<E>;
export { Err, Err$1 as ErrType, Ok, Ok$1 as OkType };