# type-assertions

> Assertions to test your TypeScript types.

Latest version **1.1.0** (published 2019-08-20) · 0 weekly downloads

## Install

```sh
npm install type-assertions
pnpm add type-assertions
yarn add type-assertions
bun add type-assertions
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-08-20 |
| First published | 2019-03-23 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Maintainers | forbeslindesay |

## Links

- npm: https://www.npmjs.com/package/type-assertions
- Repository: https://github.com/ForbesLindesay/type-assertions
- Homepage: https://github.com/ForbesLindesay/type-assertions#readme
- Issues: https://github.com/ForbesLindesay/type-assertions/issues
- npm.io page: https://npm.io/package/type-assertions

## Recent versions

- 1.1.0 (latest) — 2019-08-20
- 1.0.0 — 2019-03-23

## README

# Type Assertions

Assertions to test your TypeScript types.

## Usage

Define a `type-tests.ts` file and you can make assertions like:

```ts
import * as ta from 'type-assertions';

ta.assert<ta.Not<ta.Equal<{x: 1}, never>>>();
ta.assert<ta.Not<ta.Equal<never, {x: 1}>>>();

ta.assert<ta.Not<ta.Equal<{x: 1}, {y: 1}>>>();
ta.assert<ta.Not<ta.Equal<{y: 1}, {x: 1}>>>();

ta.assert<ta.Extends<{x: 1}, any>>();
ta.assert<ta.Not<ta.Extends<any, {x: 1}>>>();

ta.assert<ta.UnionIncludesExact<string | number, string>>();
ta.assert<ta.Not<ta.UnionIncludesExact<string | number, 'hello'>>>();
ta.assert<ta.Not<ta.UnionIncludesExact<number, 'hello'>>>();
```

When you run the build, you will get errors in typesctipt if any of your assertions are not valid.

## License

MIT

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