Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bio-dts

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bio-dts

Generate sane and clean types from JavaScript sources

  • 0.11.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 26 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc