UNPKG

ts-data-forge

Version:

[![npm version](https://img.shields.io/npm/v/ts-data-forge.svg)](https://www.npmjs.com/package/ts-data-forge) [![npm downloads](https://img.shields.io/npm/dm/ts-data-forge.svg)](https://www.npmjs.com/package/ts-data-forge) [![License](https://img.shields.

19 lines 634 B
import { type UnwrapErr, type UnwrapOk, type UnwrapWarn } from './types.mjs'; /** * Returns the Ok value or throws if the result is Warn or Err. * * @example * * ```ts * const okValue = TernaryResult.ok('ready'); * * assert.strictEqual(TernaryResult.unwrapThrow(okValue), 'ready'); * * assert.throws( * () => TernaryResult.unwrapThrow(TernaryResult.warn('warn', 'warned')), * /Expected Ok/u, * ); * ``` */ export declare const unwrapThrow: <R extends UnknownTernaryResult>(result: R, toStr?: (value: UnwrapWarn<R> | UnwrapErr<R>) => string) => UnwrapOk<R>; //# sourceMappingURL=ternary-result-unwrap-throw.d.mts.map