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) 448 B
import type { RecoveryFn } from '../../internal/function.js'; import type { Undefinable } from '../core/undefinable.js'; export type UndefinableTryRecoveryFn<out T> = RecoveryFn<Undefinable<T>>; /** * Return _input_ as `T` if the passed _input_ is not `undefined`. * Otherwise, return the result of _recoverer_. */ export declare function orElseForUndefinable<T>(input: Undefinable<T>, recoverer: UndefinableTryRecoveryFn<T>): Undefinable<T>;