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) • 617 B
TypeScript
import type { AsyncRecoveryFn } from '../../internal/function.js';
import { type Undefinable, type NotUndefined } from '../core/undefinable.js';
/**
* Return _input_ as `T` if the passed _input_ is not `undefined`.
* Otherwise, return the result of _recoverer_.
*
* * The result of _recoverer_ must not be `Undefinable<*>`.
* * If you try to recover the value, use `orElse()`
* * If the result of _recoverer_ is `undefined`, throw `TypeError`.
*/
export declare function unwrapOrElseAsyncForUndefinable<T>(input: Undefinable<T>, recoverer: AsyncRecoveryFn<NotUndefined<T>>): Promise<NotUndefined<T>>;