Repository navigation
Release notes
This is a major release: the package is now an ES module, the CLI moved from yargs to commander, the minimum supported Node.js and TypeScript versions are raised, TypeScript 6 is supported, and the default value of the exportReferencedTypes option has changed. See the "Breaking changes" section below before upgrading.
It also has a lot of fixes for name collisions/renaming, plus noticeable performance improvements on big projects.
Thanks to @mnaoumov, @matortheeternal and @slhck for the contributions 🙏
Breaking changes
- The package is now an ES module (
"type": "module"). It can still be loaded withrequire()from CommonJS, since Node.js 24 supportsrequire(esm)(see #382) - Only the main entry point (
dts-bundle-generator) and the config schema types (dts-bundle-generator/config-schema) can be imported now. Deep imports of other files from the package (e.g.dts-bundle-generator/dist/...) no longer work (see #382) - The CLI now uses
commanderinstead ofyargs. Boolean options no longer accept values (e.g.--sort=falseis an error now), invalid options are reported in commander's format, and the--helplayout changed slightly (see #383) - The minimum supported Node.js version is now 24 (see #368)
- The minimum supported TypeScript version is now 5.4, and the supported range is capped at
<7because TypeScript 7 doesn't provide a compiler API yet (see #368 and #375) exportReferencedTypesis now disabled by default (--export-referenced-typesdefaults tofalse), so a node is exported only if it is exported from the root source file. If you enable it explicitly, the generation now fails when a referenced type can't be exported because it was renamed to avoid a name collision (see #289 and #369)
Added
- TypeScript 6 support (see #368)
- Config files can be ES modules with a default export, as well as CommonJS (see #382)
-hand-vshort flags for--helpand--version(see #383)--check-projectCLI option (checkConfigPathin the config file) to use a separate tsconfig for the validation of generated files, e.g. to validate the output with stricter options (see #293 and #370)--allow-unresolved-import-typesCLI option (compilationOptions.allowUnresolvedImportTypesin the config file) to keepimport()types whose module can't be resolved as is (and print a warning) instead of failing. Useful for libraries that intentionally check for optional modules in their typings (see #376)
Changed
- The CLI starts faster (~45ms less per run) because
commanderhas no dependencies, replacingyargsand the 12 packages it pulled in (see #383) - Namespaces declared with the
modulekeyword (declare module Foo {}) are now printed asnamespace(see #356 and #380)
Fixed
- Compatibility with the
esModuleInteropcompiler flag (see #368) - JSDoc comments are stripped from top-level exports that aren't exported directly (see #328 and #365) - thanks @matortheeternal
- Duplicated augmented types are handled incorrectly: interfaces/classes and augmented enums/namespaces in ambient modules got renamed (see #335 and #336) - thanks @mnaoumov
- Error when bundling with axios 1.7.8 (named imports of
export =module members) (see #339 and #373) - Incorrect renaming of express's
RequestandResponsetypes (references to renamed named imports ofexport =namespace members) (see #353 and #378) - References point to the wrong variable when names declared in nested scopes shadow them (see #323 and #374)
- TS5055 regression with
checkJs: trueand declarations of JS files (see #359 and #372) - Performance improvements for projects with many exports (see #364, #371 and #381)