Skip to content

10.0.0

Latest

Choose a tag to compare

@timocov timocov released this 13 Nov 02:18
4a19268

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 with require() from CommonJS, since Node.js 24 supports require(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 commander instead of yargs. Boolean options no longer accept values (e.g. --sort=false is an error now), invalid options are reported in commander's format, and the --help layout 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 <7 because TypeScript 7 doesn't provide a compiler API yet (see #368 and #375)
  • exportReferencedTypes is now disabled by default (--export-referenced-types defaults to false), 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)
  • -h and -v short flags for --help and --version (see #383)
  • --check-project CLI option (checkConfigPath in 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-types CLI option (compilationOptions.allowUnresolvedImportTypes in the config file) to keep import() 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 commander has no dependencies, replacing yargs and the 12 packages it pulled in (see #383)
  • Namespaces declared with the module keyword (declare module Foo {}) are now printed as namespace (see #356 and #380)

Fixed

  • Compatibility with the esModuleInterop compiler 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 Request and Response types (references to renamed named imports of export = 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: true and declarations of JS files (see #359 and #372)
  • Performance improvements for projects with many exports (see #364, #371 and #381)