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>`.

8 lines (7 loc) 400 B
import type { RecoveryFn } from '../../internal/function.js'; import { type Result } from '../../plain_result/core/result.js'; import type { Option } from './option.js'; /** * Transforms the `Option<T>` into a `Result<T, E>`, mapping `Some(v)` to `Ok(v)` and `None` to `Err(err())`. */ export declare function okOrElseForPlainOption<T, E>(input: Option<T>, recoverer: RecoveryFn<E>): Result<T, E>;