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

13 lines (12 loc) 513 B
import { type Result } from '../../plain_result/core/result.js'; import { type Undefinable } from '../core/undefinable.js'; /** * Return `Err<void>` if _input_ is `undefinable`. * Otherwise, return `Ok<T>` directly. */ export declare function toResultOkFromUndefinable<T>(input: Undefinable<T>): Result<T, void>; /** * Return `Ok<void>` if _input_ is `undefinable`. * Otherwise, return `Err<E>` directly. */ export declare function toResultErrFromUndefinable<E>(input: Undefinable<E>): Result<void, E>;