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) • 433 B
TypeScript
import { type Result } from '../../plain_result/result.js';
import { type Option } from './option.js';
/**
* Convert to `Some(T)` if _input_ is `Ok(T)`.
* Otherwise, return `None`.
*/
export declare function fromOkToOption<T, E>(input: Result<T, E>): Option<T>;
/**
* Convert to `Some(E)` if _input_ is `Err(E)`.
* Otherwise, return `None`.
*/
export declare function fromErrToOption<T, E>(input: Result<T, E>): Option<E>;