Skip to content

Commit 1f872b8

Browse files
robpalmetoji
authored andcommitted
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.
1 parent 7ac2b5d commit 1f872b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utils/bundle-dts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (typingsLength == typings.length)
1818
// Rename common module to glMatrix
1919
typings = typings.replace(
2020
'declare module "common" {',
21-
"export module glMatrix {"
21+
"export namespace glMatrix {"
2222
);
2323

2424
// Replace imports from other modules with direct references
@@ -28,7 +28,7 @@ typings = typings.replace(/import\("([^"]+?)(\.js)?"\)/g, "$1");
2828
typings = typings.replace(/ *import.+from.*;/g, "");
2929

3030
// Replace declare module with exports
31-
typings = typings.replace(/declare module "([^"]+?)" {/g, "export module $1 {");
31+
typings = typings.replace(/declare module "([^"]+?)" {/g, "export namespace $1 {");
3232

3333
// Add types
3434
typings = "\n" + sourceTypings.replace(/declare/g, "export") + "\n" + typings;

0 commit comments

Comments
 (0)