1. typings-tester
TypeScript definition testing library
typings-tester
Package: typings-tester
Created by: aikoven
Last modified: Tue, 28 Jun 2022 02:10:34 GMT
Version: 0.3.2
License: MIT
Downloads: 28,736
Repository: https://github.com/aikoven/typings-tester

Install

npm install typings-tester
yarn add typings-tester

Typings Tester npm version Build Status

A library aimed to aid testing of TypeScript definitions.
Checks TypeScript files for syntactic, expected and unexpected semantic (type) errors.

Installation

$ npm install -D typings-tester

Any version of TypeScript must be installed separately.

CLI Usage

$ typings-tester --config path/to/tsconfig.json **/*.ts
 
$ typings-tester --dir path/to/directory

API Usage

 import test from "tape";
import {check, checkDirectory} from "typings-tester";


test('typings', assert => {
  assert.doesNotThrow(() => check(['test.ts'], 'tsconfig.json'));
  
  assert.doesNotThrow(() => checkDirectory('src'));
});

Flags

  • typings:expect-error: expect next line or block to contain semantic error. typings-tester will fail if no error is produced.
 // typings:expect-error
function shouldFail(a: number): string {
  return a;
}

What's next

  • Testing against multiple versions of TypeScript
  • Inferred type assertions

Dependencies

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