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 (25 loc) 527 B
import { WarnTypeTagName } from './tag.mjs'; /** * Creates a `TernaryResult.Warn` containing the provided success value and * warning. * * @example * * ```ts * const caution = TernaryResult.warn({ id: 1 }, 'Needs review'); * * assert.deepStrictEqual(caution, { * $$tag: 'ts-data-forge::Result.warn', * value: { id: 1 }, * warning: 'Needs review', * }); * ``` */ export const warn = <const S, const W>( value: S, warning: W, ): TernaryWarn<S, W> => ({ $$tag: WarnTypeTagName, value, warning, });