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

9 lines (8 loc) 396 B
import type { RecoveryFn } from '../../internal/function.js'; import type { Option } from './option.js'; export type OptionTryRecoveryFn<out T> = RecoveryFn<Option<T>>; /** * Return _input_ as `T` if the passed _input_ is `Some(T)`. * Otherwise, return the result of _recoverer_. */ export declare function orElseForOption<T>(input: Option<T>, recoverer: OptionTryRecoveryFn<T>): Option<T>;