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>`.
11 lines (10 loc) • 430 B
TypeScript
import { type Result } from '../../plain_result/core/result.js';
import { type Undefinable } from '../core/undefinable.js';
/**
* Transposes a `Undefinable` of a `Result` into an `Result` of a `Undefinable`.
*
* - `undefined` -> `Ok<undefined>`.
* - `Ok<T>` -> `Ok<T>`.
* - `Err<E>` -> `Err<E>`.
*/
export declare function transposeUndefinableToResult<T, E>(input: Undefinable<Result<T, E>>): Result<Undefinable<T>, E>;