Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generated namespace types in index.d.ts #487

Merged
merged 1 commit into from
Mar 28, 2025

Conversation

robpalme
Copy link
Contributor

@robpalme robpalme commented Mar 22, 2025

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 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.
Copy link
Owner

@toji toji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@toji toji merged commit 1f872b8 into toji:master Mar 28, 2025
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