$ npm install @putout/types
npm i @putout/types
Every 🐊Putout operator ships TypeScript types written by TDD for types. Write a .d.ts and a test/errors.ts, validate with check-dts.
Add test:dts script to .madrun.js then to update package.json run:
madrun --init
Add check-dts to devDependencies with nupdate check-dts -aD. Then you need:
lib/<name>.d.ts — export function signatures with typestest/errors.ts — call each export with invalid args, mark with // THROWSredrun test:dts
// test/errors.ts
import {addArgs} from '../lib/add-args.js';
// THROWS Argument of type 'number' is not assignable to parameter of type 'AddArgsOptions'
addArgs(5);
Every // THROWS is a test. check-dts compiles the file and checks the error matches.
MIT
© 2010 - cnpmjs.org x YWFE | Home | YWFE