Skip to content

aikoven/typings-tester

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

Note: There's an official tool that provides similar functionality and might be a better choice.

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