@consolidados/results
Version:
Result types, ease and simple
26 lines (23 loc) • 879 B
text/typescript
import { N as None$1, S as Some$1 } from '../option-DpT8KCGE.cjs';
export { O as Option } from '../option-DpT8KCGE.cjs';
/**
* Creates a new `Some` instance, representing an `Option` with a value.
* @template T The type of the value contained in the `Some`.
* @param value The value to wrap in the `Some` instance.
* @returns A `Some` instance containing the given value.
* @example
* const option = Some(42);
* console.log(option.isSome()); // true
* console.log(option.unwrap()); // 42
*/
declare function Some<T>(value: T): Some$1<T>;
/**
* Creates a new `None` instance, representing an `Option` with no value.
* @returns A `None` instance.
* @example
* const option = None();
* console.log(option.isNone()); // true
* console.log(option.unwrap()); // throws Error: "Called unwrap on a None value"
*/
declare function None(): None$1;
export { None, Some };