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) • 430 B
TypeScript
import type { AsyncRecoveryFn } from '../../internal/function.js';
import { type Option } from './option.js';
export type OptionAsyncTryRecoveryFn<out T> = AsyncRecoveryFn<Option<T>>;
/**
* Return _input_ as `T` if the passed _input_ is `Some(T)`.
* Otherwise, return the result of _recoverer_.
*/
export declare function orElseAsyncForOption<T>(input: Option<T>, recoverer: OptionAsyncTryRecoveryFn<T>): Promise<Option<T>>;