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