From 488fa4fabede0c3e35c9b03626ee9ed4e9925ba9 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 11 Nov 2024 00:44:16 -0800 Subject: [PATCH] Do not use `declare module` in first-party type declarations 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 --- runtime.d.ts | 6 ++---- types/index.d.ts | 4 ---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/runtime.d.ts b/runtime.d.ts index 0d5105eb7..42ebad7e7 100644 --- a/runtime.d.ts +++ b/runtime.d.ts @@ -1,5 +1,3 @@ -import Handlebars = require('handlebars') +import Handlebars = require('handlebars'); -declare module "handlebars/runtime" { - -} \ No newline at end of file +export = Handlebars; diff --git a/types/index.d.ts b/types/index.d.ts index 00b1381ab..6011626a5 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -270,8 +270,4 @@ export interface Logger { export type CompilerInfo = [number/* revision */, string /* versions */]; -declare module "handlebars/runtime" { - export = Handlebars; -} - export default Handlebars;