0.11.0 • Published 2 months ago

bio-dts v0.11.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

bio-dts

CI

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';

// transform JS so it keeps the shape,
// but is properly digestable by the typescript
// compiler
const transformedCode = preTransform(jsCode);

// post process typescript compiler type code
// removing internals, and fixing up the definitions
const transformedCode = postTransform(tsCode);

// execute the full pipeline, including invoking the
// typescript compiler
generateTypes(files, {
  outDir: 'dist'
});
0.11.0

2 months ago

0.10.0

3 months ago

0.9.0

3 months ago

0.8.1

1 year ago

0.8.0

1 year ago

0.7.0

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.0

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago