From f7633c20b96db9142e48bd406732db788881588d Mon Sep 17 00:00:00 2001 From: Rob Palmer Date: Sat, 22 Mar 2025 10:12:23 +0000 Subject: [PATCH] Fix generated types in index.d.ts Previously namespace types were declared generated using the legacy `module` keyword from ten years ago. Now we emit the modern TS `namespace` keyword. The outer Ambient Module Declaration intentionally remains untouched because it is not a namespace. --- utils/bundle-dts.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/bundle-dts.js b/utils/bundle-dts.js index d16ffcc6..d979e542 100644 --- a/utils/bundle-dts.js +++ b/utils/bundle-dts.js @@ -18,7 +18,7 @@ if (typingsLength == typings.length) // Rename common module to glMatrix typings = typings.replace( 'declare module "common" {', - "export module glMatrix {" + "export namespace glMatrix {" ); // Replace imports from other modules with direct references @@ -28,7 +28,7 @@ typings = typings.replace(/import\("([^"]+?)(\.js)?"\)/g, "$1"); typings = typings.replace(/ *import.+from.*;/g, ""); // Replace declare module with exports -typings = typings.replace(/declare module "([^"]+?)" {/g, "export module $1 {"); +typings = typings.replace(/declare module "([^"]+?)" {/g, "export namespace $1 {"); // Add types typings = "\n" + sourceTypings.replace(/declare/g, "export") + "\n" + typings;