Skip to content

Always include spelling suggestions in name errors #1440

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

Merged
merged 2 commits into from
Jul 23, 2025
Merged

Conversation

ahejlsberg
Copy link
Member

Fixes #1383.

@ahejlsberg ahejlsberg requested review from Copilot and jakebailey and removed request for Copilot July 23, 2025 22:38
Copy link
Contributor

@Copilot Copilot AI left a 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 implements a change to always include spelling suggestions in TypeScript name error messages. The modification enhances error messages by providing helpful suggestions when identifiers cannot be found, upgrading error codes from TS2304 ("Cannot find name") to TS2552 ("Cannot find name ... Did you mean ...?") when appropriate suggestions are available.

  • Replaces generic "Cannot find name" errors with more helpful "Did you mean" suggestions
  • Adds related error information showing where suggested alternatives are declared
  • Maintains consistent error messaging across TypeScript conformance test cases

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.

File Description
Multiple .errors.txt files Updated baseline error messages to include spelling suggestions for undefined identifiers
Multiple .errors.txt.diff files Show the transition from TS2304 to TS2552 error codes with spelling suggestions

@ahejlsberg ahejlsberg enabled auto-merge July 23, 2025 23:20
@ahejlsberg ahejlsberg added this pull request to the merge queue Jul 23, 2025
Merged via the queue into main with commit b780b19 Jul 23, 2025
22 checks passed
@ahejlsberg ahejlsberg deleted the fix-1383 branch July 23, 2025 23:34
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.

Duplicate "Cannot find name" error
2 participants