# ts-invariant

> TypeScript implementation of invariant(condition, message)

Latest version **0.10.3** (published 2022-05-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install ts-invariant
pnpm add ts-invariant
yarn add ts-invariant
bun add ts-invariant
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.10.3 |
| Published | 2022-05-13 |
| First published | 2019-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 1 |
| Unpacked size | 27.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 94 |
| Author | Ben Newman |
| Maintainers | benjamn |
| Keywords | invariant, assertion, precondition, TypeScript |

## Links

- npm: https://www.npmjs.com/package/ts-invariant
- Repository: https://github.com/apollographql/invariant-packages
- Issues: https://github.com/apollographql/invariant-packages/issues
- npm.io page: https://npm.io/package/ts-invariant

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.1.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.10.3 (latest) — 2022-05-13
- 0.10.2 — 2022-05-04
- 0.10.1 — 2022-02-04
- 0.10.0 — 2022-02-04
- 0.9.4 — 2021-12-07
- 0.9.3 — 2021-09-09
- 0.9.2 — 2021-09-09
- 0.9.1 — 2021-08-03
- 0.9.0 — 2021-07-12
- 0.8.2 — 2021-06-16
- 0.8.1 — 2021-06-16
- 0.8.0 — 2021-06-16
- 0.7.5 — 2021-06-16
- 0.7.4 — 2021-06-16
- 0.7.3 — 2021-03-19
- … 21 more at https://npm.io/package/ts-invariant/versions

## README

# ts-invariant

[TypeScript](https://www.typescriptlang.org) implementation of
[`invariant(condition, message)`](https://www.npmjs.com/package/invariant).

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`](../../archived/rollup-plugin-invariant).

The verbosity of these methods can be globally reconfigured using the
`setVerbosity` function:
```ts
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
```

---
_Source: https://npm.io/package/ts-invariant · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
