1. check-dts
Unit tests for .d.ts TypeScript definitions
check-dts
Package: check-dts
Created by: ai
Last modified: Wed, 12 Jul 2023 19:12:07 GMT
Version: 0.7.2
License: MIT
Downloads: 5,140
Repository: https://github.com/ai/check-dts

Install

npm install check-dts
yarn add check-dts

Check TypeScript Definitions

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

It is useful for non-TypeScript project, which wants to provide typing
support for TypeScript users and autocompletion for IDE and text editors.

It becomes especially useful for complex types with generics, like 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 Sponsored by Evil Martians

Docs

Read full docs here.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code