Skip to content

Comparisons

WARNING

This page is a work in progress. It lacks the full context, but contains some information to why I've wrote another tool for bundling types. I plan to create a repo to properly compare the different tools and update this page as soon as possible.

TypeScript

TypeScript and its tsc CLI allows emitting declaration files from respective .ts files.

Compared to dtsbuild, tsc doesn't support bundling types and individual .d.ts files are expected to be published as is. This means that internal and non-public types may be exposed unnecessarily.

API Extractor

API Extractor has a wide range of features for analyzing, validating, and bundling the API surface of TypeScript libraries. Among its features it supports bundling types.

Compared to dtsbuild, API Extractor is trickier to set up as other features are configured together. It also only supports bundling types from a single entry point.

rollup-plugin-dts and rolldown-plugin-dts

rollup-plugin-dts and rolldown-plugin-dts are both similar plugins for Rollup and Rolldown respectively to enable the bundler to bundle types. They preprocess and postprocess the types as JS to allow the bundler to understand and optimize them.

Compared to dtsbuild, dtsbuild is written for TypeScript first and can bundle types directly, leading to better heuristics and output.

dts-bundle-generator

dts-bundle-generator is a types bundler written in JS. It uses the TypeScript compiler API for resolving paths and types, which allows it to match TypeScript's behavior closely.

Compared to dtsbuild, while it supports multiple entry points, it doesn't generate a common chunk for the shared types.