bio-dts
Utilities to generate sane and clean type definitions from JavaScript files.
About
This module provides pre
and post
processing helpers to a type definition pipeline.
You can use it via API or through a simple generator cli.
Usage
npx bio-dts --outDir dist/types -r lib
Features
Generates clean type definitions from ES5 code bases:
- ES5 prototypical classes + inheritance
- Optional parameters before required ones
- Function overloading (via
@overlord
annotations, actually works!) - Converts JSDoc to TSDoc
- Only exposed documented parameters
- Validates, where needed declared parameters
Checkout the test fixtures for full coverage.
API
import {
preTransform,
postTransform,
generateTypes
} from 'bio-dts';
const transformedCode = preTransform(jsCode);
const transformedCode = postTransform(tsCode);
generateTypes(files, {
outDir: 'dist'
});