-
Notifications
You must be signed in to change notification settings - Fork 12.9k
fix: diagnostic message for class name 'Object' when targeting different ECMAScript versions #61850
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
base: main
Are you sure you want to change the base?
fix: diagnostic message for class name 'Object' when targeting different ECMAScript versions #61850
Conversation
…ent ECMAScript versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the diagnostic error message for class names, changing the wording from "targeting ES5" to "targeting ES5 and above" for modules NodeNext, Node18, and Node16. These changes ensure that the error messages more accurately reflect the capabilities of the compiler regarding ECMAScript version support.
- Updates error message text in various test baseline files for both TypeScript and JavaScript extensions.
- Updates the diagnostic message text in diagnosticMessages.json.
- Updates the error call in checker.ts to reference the new diagnostic message.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).errors.txt | Updated error message wording for NodeNext test. |
tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt | Updated error message wording for Node18 test. |
tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node16).errors.txt | Updated error message wording for Node16 test. |
tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=nodenext).errors.txt | Updated error message wording for NodeNext allowJs test. |
tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt | Updated error message wording for Node18 allowJs test. |
tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node16).errors.txt | Updated error message wording for Node16 allowJs test. |
src/compiler/diagnosticMessages.json | Updated the diagnostic message text to include "and above". |
src/compiler/checker.ts | Updated error() call to reference the new diagnostic message. |
Comments suppressed due to low confidence (8)
tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).errors.txt:3
- Ensure the updated error message wording 'targeting ES5 and above' is intentional and consistent with other module variants in the baseline tests.
+subfolder/index.ts(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module NodeNext.
tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt:3
- Verify that this update to include 'and above' in the error message for Node18 is aligned with the intended diagnostic behavior.
+subfolder/index.ts(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node18.
tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node16).errors.txt:3
- Confirm that the new diagnostic message for Node16 baseline now correctly states 'targeting ES5 and above'.
+subfolder/index.ts(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node16.
tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=nodenext).errors.txt:3
- Ensure that the updated error message is reflected in the allowJs tests for NodeNext without regressions.
+subfolder/index.js(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module NodeNext.
tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt:3
- Confirm that the allowJs baseline tests for Node18 consistently use the new error message wording.
+subfolder/index.js(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node18.
tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node16).errors.txt:3
- Verify that the change in error message wording for Node16 allowJs tests aligns with the overall diagnostic update.
+subfolder/index.js(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node16.
src/compiler/diagnosticMessages.json:3422
- The diagnostic message update now correctly reflects the additional ECMAScript versions; please verify that the message template works as intended for all modules.
+ "Class name cannot be 'Object' when targeting ES5 and above with module {0}.": {
src/compiler/checker.ts:46572
- Ensure that the reference to the new diagnostic message in the error() call is consistent with the updated text in diagnosticMessages.json.
+ error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0, ModuleKind[moduleKind]);
Fixes: #61270