Minifier for TypeScript declaration files (.d.ts). Strips non-essential whitespace, newlines, and comments (preserving triple-slash directives) to reduce file size. Current stable version is 0.3.3. Released on both npm and JSR, maintained by dsherret. Designed for projects where .d.ts files are not read by humans, such as bundling for libraries. Differentiates by being lightweight and focused solely on .d.ts minification, unlike general-purpose minifiers.
npm install dts-minifyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import, create a minifier, and minify a .d.ts content with and without keeping JSDoc comments.
Ensure 'typescript' is installed as a dependency and pass ts module to createMinifier.
Validate your .d.ts file with a TypeScript parser before calling minifier.minify().
If you need to keep other comments (e.g., @deprecated), set keepJsDocs: true or handle manually.
Change to: import { createMinifier } from 'dts-minify'Run: npm install typescript
Ensure you call createMinifier(ts) with the full 'typescript' module object.