Check TypeScript Definitions

Services & Skills

Share on

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

// 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<Events>('set', 2)
// Positive test: test/index.types.ts
import lib = require('../')

interface Events {
  'set': (a: string, b: number) => void
}
lib.on<Events>('set', 'prop', 1)
Print Snapshots example
Author

In the same orbit

Explore more open source projects

How can we help you?

Martians at a glance
17
years in business

We transform growth-stage startups into unicorns, build developer tools, and create open source products.

If you prefer email, write to us at surrender@evilmartians.com