You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a deprecated method is called on something that is not a plain name, such as object().passthrough(), this.m(), x["m"]() or (x.m)(), the suggestion showed the signature instead of the name: '(): Schema' is deprecated.
tryGetPropertyAccessOrIdentifierToString returns nothing for these receivers. As suggested in the review on #62406, checkDeprecatedSignature now skips parentheses around the callee and falls back to the member name (Name() for property accesses, including #private ones; GetElementOrPropertyAccessName for literal bracket accesses), giving The signature '(): Schema' of 'passthrough' is deprecated. Calls that already had a name are unchanged.
The issue is locked, so I could not comment there first.
Testing
New fourslash test deprecatedSignatureMemberName_test.go covers object().passthrough(), object()["passthrough"](), (object().passthrough)(), this.m() and this.#p(); all five fail without the change and pass with it.
AI disclosure
I used an AI assistant (Claude, Opus 5.5) to investigate, draft the change and test, and review them. I've read and understand the change and will handle the review myself.
Unwrap parenthesized member callees before extracting the name
tsc/internal/checker/checker.go:8542
Parenthesized member callees still fall back to the signature-only diagnostic. For example, (object().passthrough)() makes GetInvokedExpression return a ParenthesizedExpression, so neither this helper nor the new access-expression switch reaches passthrough. Unwrap parentheses before extracting the name, as getDeprecatedSuggestionNode already does.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟢 Approval recommended
The focused implementation handles the reported cases and includes comprehensive regression coverage.
Review effort: Balanced Findings: None
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #62396
When a deprecated method is called on something that is not a plain name, such as
object().passthrough(),this.m(),x["m"]()or(x.m)(), the suggestion showed the signature instead of the name:'(): Schema' is deprecated.tryGetPropertyAccessOrIdentifierToStringreturns nothing for these receivers. As suggested in the review on #62406,checkDeprecatedSignaturenow skips parentheses around the callee and falls back to the member name (Name()for property accesses, including#privateones;GetElementOrPropertyAccessNamefor literal bracket accesses), givingThe signature '(): Schema' of 'passthrough' is deprecated.Calls that already had a name are unchanged.The issue is locked, so I could not comment there first.
Testing
New fourslash test
deprecatedSignatureMemberName_test.gocoversobject().passthrough(),object()["passthrough"](),(object().passthrough)(),this.m()andthis.#p(); all five fail without the change and pass with it.AI disclosure
I used an AI assistant (Claude, Opus 5.5) to investigate, draft the change and test, and review them. I've read and understand the change and will handle the review myself.