Skip to content

Report the member name instead of the signature in deprecation suggestions - #64443

Open
GON (gonappuccino) wants to merge 3 commits into
microsoft:mainfrom
gonappuccino:fix-62396-deprecated-signature-name
Open

GON (gonappuccino) wants to merge 3 commits into
microsoft:mainfrom
gonappuccino:fix-62396-deprecated-signature-name

Conversation

@gonappuccino

@gonappuccino GON (gonappuccino) commented Sep 25, 2026 •

Copy link
Copy Markdown

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.

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.

Copilot AI balanced review requested due to automatic review settings September 25, 2026 04:55
@typescript-automation typescript-automation Bot added the For Backlog Bug PRs that fix a backlog bug label Sep 25, 2026
@gonappuccino

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The fallback excludes private method names such as this.#m().

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Improves deprecation suggestions by reporting member names when full access paths are unavailable.

Changes:

  • Adds member-name fallback logic for access expressions.
  • Adds fourslash coverage for call, bracket, and this receivers.
File Description
tsc/​internal/​checker/​checker.go Extracts member names for deprecation diagnostics.
tsc/​internal/​fourslash/​tests/​deprecatedSignatureMemberName_test.go Verifies updated diagnostics.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread tsc/internal/checker/checker.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Parenthesized member callees still produce the signature-only diagnostic.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Deprecation error message reporting method type as deprecated instead of method name

2 participants