Ban non-ambient namespaces written with module keyword#61450
Ban non-ambient namespaces written with module keyword#61450RyanCavanaugh wants to merge 4 commits intomicrosoft:mainfrom
module keyword#61450Conversation
|
@typescript-bot test top800 |
|
@RyanCavanaugh Here are the results of running the top 800 repos with tsc comparing Something interesting changed - please have a look. Details
|
module keywordmodule keyword
|
@typescript-bot test top800 |
|
Hey @RyanCavanaugh, the results of running the DT tests are ready. Everything looks the same! |
|
@RyanCavanaugh Here are the results of running the top 800 repos with tsc comparing Something interesting changed - please have a look. Details
|
|
gl-matrix builds index.d.ts from JS source (with |
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.
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.
Draft PR to assess the prevalence of these in the wild (error message is reusing the ESO one).