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