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

12 lines (11 loc) 415 B
import { type Result } from '../../plain_result/core/result.js'; import { type Maybe } from '../core/maybe.js'; /** * Transposes a `Maybe` of a `Result` into an `Result` of a `Maybe`. * * - `null` -> `Ok<null>`. * - `undefined` -> `Ok<undefined>` * - `Ok<T>` -> `Ok<T>`. * - `Err<E>` -> `Err<E>`. */ export declare function transposeMaybeToResult<T, E>(input: Maybe<Result<T, E>>): Result<Maybe<T>, E>;