# Check TypeScript Definitions

> Unit tests for TypeScript definitions in your JavaScript open source library.

- URL: https://evilmartians.com/opensource/check-dts
- GitHub: https://github.com/ai/check-dts
- Authors: Andrey Sitnik

---

Unit tests for TypeScript definitions in your JavaScript open source library. It is useful for non-TypeScript projects that want to provide typing support for TypeScript users and autocompletion for IDE and text editors.

`check-dts` becomes especially useful for testing libraries with with TypeScript generics, like the ones we have in [Nano Events] or [Storeon].

```ts
// Negative test: test/index.errors.ts
import lib = require('../')

interface Events {
  'set': (a: string, b: number) => void
}
// THROWS Expected 3 arguments, but got 2
lib.on('set', 2)
```

```ts
// Positive test: test/index.types.ts
import lib = require('../')

interface Events {
  'set': (a: string, b: number) => void
}
lib.on('set', 'prop', 1)
```

[Nano Events]: https://github.com/ai/nanoevents
[Storeon]: https://evilmartians.com/opensource/storeon

*Image: Print Snapshots example*
