ts-invariant

TypeScriptarrow-up-right implementation of invariant(condition, message)arrow-up-right.

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-invariantarrow-up-right.

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

Last updated