Deprecate `module` syntax
See #54500 Fixes #62211
This changes the existing suggestion diagnostic to an error when you write forms like module foo or module foo.bar {
~The ambient form declare module foo { is still ok~ edit: no, we agreed in #62211 to also deprecate that form, as is the ambient module declaration form declare module "specifier" {
@typescript-bot test top800
Starting jobs; this comment will be updated as builds start and complete.
| Command | Status | Results |
|---|---|---|
test top800 |
✅ Started | ✅ Results |
@RyanCavanaugh Here are the results of running the top 800 repos with tsc comparing main and refs/pull/62876/merge:
Everything looks good!
@typescript-bot pack this
Starting jobs; this comment will be updated as builds start and complete.
| Command | Status | Results |
|---|---|---|
pack this |
✅ Started | ✅ Results |
Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:
{
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/166787/artifacts?artifactName=tgz&fileId=5B5A1DC78D2CF32FC54B5EBC8ACD09579FF86E294083153584D973D89884D14D02&fileName=/typescript-6.0.0-insiders.20251211.tgz"
}
}
and then running npm install.
There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;
Thanks for the pack. A quick try out suggest that when you provoke the intended checker error, it crashes.
Error: Debug Failure. Should never get an Info diagnostic on the command line.
at getCategoryFormat (/home/projects/stackblitz-starters-ybxu3fvk/node_modules/typescript/lib/_tsc.js:121656:20)
at formatDiagnosticsWithColorAndContext (/home/projects/stackblitz-starters-ybxu3fvk/node_modules/typescript/lib/_tsc.js:121721:71)
A quick try out suggest that when you provoke the intended checker error, it crashes.
Well, that's one way to get people to change their code 🤦
@typescript-bot test top800 @typescript-bot pack this
Starting jobs; this comment will be updated as builds start and complete.
| Command | Status | Results |
|---|---|---|
test top800 |
✅ Started | 👀 Results |
pack this |
✅ Started | ✅ Results |
Hey @RyanCavanaugh, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:
{
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/166789/artifacts?artifactName=tgz&fileId=F7B95EBDF36B0403901B7D4CB436D9FE693D2E5245B7A658F1362E103A40D18402&fileName=/typescript-6.0.0-insiders.20251211.tgz"
}
}
and then running npm install.
There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;
The new pack works great. No crashes!
And it correctly errors on the declare form. Thank you for that update 💙
The only issue I observe is that for all forms, the error squiggles are on the identifier, not the keyword. Which seems a bit misleading.
index.ts:3:16 - error TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.
3 declare module types {
~~~~~
Found 1 error in index.ts:3
@RyanCavanaugh Here are the results of running the top 800 repos with tsc comparing main and refs/pull/62876/merge:
Something interesting changed - please have a look.
Details
microsoft/vscode
11 of 63 projects failed to build with the old tsc and were ignored
src/tsconfig.tsec.json
error TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.- src/vs/editor/standalone/browser/standaloneServices.ts#L1174
- src/vs/platform/extensionManagement/node/extensionSignatureVerificationService.ts#L37
- src/vs/platform/sign/browser/signService.ts#L14
- src/vs/platform/sign/node/signService.ts#L9
- src/vs/server/node/remoteExtensionHostAgentServer.ts#L46
- src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L23
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L36
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L58
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L120
src/tsconfig.monaco.json
error TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.
build/checker/tsconfig.worker.json
error TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.
build/checker/tsconfig.electron-utility.json
error TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.- src/vs/platform/extensionManagement/node/extensionSignatureVerificationService.ts#L37
- src/vs/platform/sign/node/signService.ts#L9
- src/vs/server/node/remoteExtensionHostAgentServer.ts#L46
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L36
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L58
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L120
build/checker/tsconfig.electron-main.json
error TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.- src/vs/platform/extensionManagement/node/extensionSignatureVerificationService.ts#L37
- src/vs/platform/sign/node/signService.ts#L9
- src/vs/server/node/remoteExtensionHostAgentServer.ts#L46
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L36
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L58
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L120
build/checker/tsconfig.electron-browser.json
error TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.- src/vs/editor/standalone/browser/standaloneServices.ts#L1174
- src/vs/platform/sign/browser/signService.ts#L14
- src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L23
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L36
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L58
- src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L120
@typescript-bot test top800
Starting jobs; this comment will be updated as builds start and complete.
| Command | Status | Results |
|---|---|---|
test top800 |
✅ Started | ✅ Results |
@jakebailey Here are the results of running the top 800 repos with tsc comparing main and refs/pull/62876/merge:
Everything looks good!