ts-invariant
TypeScript icon, indicating that this package has built-in type declarations

0.10.3 • Public • Published

ts-invariant

TypeScript implementation of invariant(condition, message).

Supports invariant.log, invariant.warn, and invariant.error, which wrap console methods of the same name, and may be stripped in production by rollup-plugin-invariant.

The verbosity of these methods can be globally reconfigured using the setVerbosity function:

import { setVerbosity } from "ts-invariant";

setVerbosity("log"); // display all messages (default)
setVerbosity("warn"); // display only warnings and errors
setVerbosity("error"); // display only errors
setVerbosity("silent"); // display no messages

/ts-invariant/

    Package Sidebar

    Install

    npm i ts-invariant

    Weekly Downloads

    3,735,695

    Version

    0.10.3

    License

    MIT

    Unpacked Size

    28.5 kB

    Total Files

    18

    Last publish

    Collaborators

    • benjamn