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

15 lines (14 loc) 595 B
import type { MutResult as InternalMutResult } from '../internal/mutable.js'; import type { Result } from '../result.js'; /** * This allows to mutate the value to save needless allocation. * * We don't define `MutOk<T>` or `MutErr` because we can always mutable properties on `MutResult<T>`. * This means that it's hard to check the type on static type system. */ export type MutResult<T, E> = InternalMutResult<T, E>; /** * @throws * This throw an `Error` instance if the _input_ is frozen. */ export declare function unsafeAsMutResult<T, E>(input: Result<T, E>): MutResult<T, E>;