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.

27 lines 733 B
/** * Creates a `Result.Err` containing the given error value. * * Use this constructor when an operation fails and you want to wrap the error * information in a Result type for consistent error handling. * * @example * * ```ts * const success = Result.ok({ id: 1 }); * * const failure = Result.err(new Error('missing data')); * * assert.deepStrictEqual(success, { * $$tag: 'ts-data-forge::Result.ok', * value: { id: 1 }, * }); * * assert.isTrue(Result.isErr(failure)); * ``` * * @template E The type of the error value. * @param value The error value. * @returns A `Result.Err<E>` containing the value. */ export declare const err: <const E>(value: E) => Err<E>; //# sourceMappingURL=result-err.d.mts.map