Skip to content

Commit

Permalink
Do not use declare module in first-party type declarations
Browse files Browse the repository at this point in the history
First-party type declarations should simply be provided at top level
in .d.ts files with the right filenames.

The `declare module` was breaking usage like `import
"handlebars/runtime.js"` (which happens to be the only way to import
the runtime from a project with native ES modules, "type": "module").

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
  • Loading branch information
andersk committed Nov 11, 2024
1 parent f422bfd commit 488fa4f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 2 additions & 4 deletions runtime.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Handlebars = require('handlebars')
import Handlebars = require('handlebars');

declare module "handlebars/runtime" {

}
export = Handlebars;
4 changes: 0 additions & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,4 @@ export interface Logger {

export type CompilerInfo = [number/* revision */, string /* versions */];

declare module "handlebars/runtime" {
export = Handlebars;
}

export default Handlebars;

0 comments on commit 488fa4f

Please sign in to comment.