UNPKG

option-t

Version:

A toolkit of Nullable/Option/Result type implementation in ECMAScript. Their APIs are inspired by Rust's `Option<T>` and `Result<T, E>`.

13 lines (12 loc) 469 B
import type { Undefinable } from '../../undefinable/core/undefinable.js'; import type { Result } from '../core/result.js'; /** * Unwrap `T` if _input_ is `Ok(T)`. * Otherwise, return `undefined`. */ export declare function toUndefinableFromOk<T>(input: Result<T, unknown>): Undefinable<T>; /** * Unwrap `E` if _input_ is `Err(E)`. * Otherwise, return `undefined`. */ export declare function toUndefinableFromErr<E>(input: Result<unknown, E>): Undefinable<E>;