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) 367 B
import type { RecoveryFromErrorFn } from '../internal/function.js'; import { type Result } from './result.js'; /** * Unwraps a result _input_, returns the content of an `Ok(T)`. * If the value is an `Err(E)` then it calls `def` with its value. */ export declare function unwrapOrElseForResult<T, E>(input: Result<T, E>, recoverer: RecoveryFromErrorFn<E, T>): T;