Skip to content

Conversation

@robpalme
Copy link
Contributor

@robpalme robpalme commented Jul 12, 2025

This backports #487 (comment) to v3.4.x branch


Previously some namespace types were generated using the legacy module keyword from ten years ago. Now we emit the modern TS namespace keyword that has been the preferred keyword since TypeScript 1.5 in 2015.

Please review the resulting diff for the generated dist/index.d.ts file: https://gist.github.com/robpalme/a320dc3f0cb50bcd14962bca46827dae/revisions

Note that the outer Ambient Module Declaration intentionally remains untouched because it is not a namespace. These are differentiated by using a quoted string rather than a bare identifier

module "quoted" {
vs
module bare {}


Background: This usage of the legacy keyword was found by a TypeScript real-world test suite that checks the compatibility of proposed changes. Using the module keyword for namespaces is proposed for deprecation in TypeScript 6.0 so it's worth getting ahead of this.

Previously some namespace types were generated using the legacy `module` keyword from ten years ago. Now we emit the modern TS `namespace` keyword that has been the preferred keyword since TypeScript 1.5 in 2015.

Please review the resulting diff for the generated `dist/index.d.ts` file:  https://gist.github.com/robpalme/a320dc3f0cb50bcd14962bca46827dae/revisions

Note that the outer _Ambient Module Declaration_ intentionally remains untouched because it is not a namespace.  These are differentiated by using a quoted string rather than a bare identifier

`module "quoted" {`
vs
`module bare {}`

---

Background:  This usage of the legacy keyword was found by [a TypeScript real-world test suite](microsoft/TypeScript#61450 (comment)) that checks the compatibility of proposed changes.  Using the `module` keyword for namespaces is [proposed for deprecation in TypeScript 6.0](microsoft/TypeScript#54500 (comment)) so it's worth getting ahead of this.
@toji toji merged commit 6071f77 into toji:v3.4.x Jul 14, 2025
@toji
Copy link
Owner

toji commented Jul 14, 2025

LGTM, thanks!

@robpalme
Copy link
Contributor Author

Please could we get a v3.4.4 npm release to make this PR available to consuming projects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants