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

12 lines (11 loc) 553 B
import type { RecoveryFn } from '../../internal/function.js'; import { type NotNull, type Nullable } from '../core/nullable.js'; /** * Return _input_ as `T` if the passed _input_ is not `null`. * Otherwise, return the result of _recoverer_. * * * The result of _recoverer_ must not be `Nullable<*>`. * * If you try to recover the value, use `orElse()` * * If the result of _recoverer_ is `null`, throw `TypeError`. */ export declare function unwrapOrElseForNullable<T>(input: Nullable<T>, recoverer: RecoveryFn<NotNull<T>>): NotNull<T>;