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

9 lines (8 loc) 526 B
import type { AsyncRecoveryFromErrorFn } from '../../internal/function.js'; import { type Result } from '../core/result.js'; export type ResultAsyncTryRecoveryFromErrorFn<in E, out T, out F> = AsyncRecoveryFromErrorFn<E, Result<T, F>>; /** * Calls _recoverer_ and return its returned value if the result is `Err(E)`, * otherwise returns the `Ok(T)` value of self. */ export declare function orElseAsyncForResult<T, E, F>(input: Result<T, E>, recoverer: ResultAsyncTryRecoveryFromErrorFn<E, T, F>): Promise<Result<T, F>>;