Skip to content

Fix(deprecation): report method name instead of type for deprecated methods#62406

Closed
hanseul37 wants to merge 3 commits intomicrosoft:mainfrom
hanseul37:fix62396
Closed

Fix(deprecation): report method name instead of type for deprecated methods#62406
hanseul37 wants to merge 3 commits intomicrosoft:mainfrom
hanseul37:fix62396

Conversation

@hanseul37
Copy link
Copy Markdown

@hanseul37 hanseul37 commented Sep 5, 2025

Fix deprecation message to show method name instead of type (#62396)

Changes

  • Corrected the deprecation diagnostic message to display the actual method name instead of the method type.
  • Modified checkDeprecatedSignature and addDeprecatedSuggestionWithSignature functions to extract and show the invoked method name.

Summary of Changes

  1. In checkDeprecatedSignature:

    • Extract the invoked expression's name using tryGetPropertyAccessOrIdentifierToString.
    • If the name is missing and the expression is a PropertyAccessExpression, retrieve the name from propAccess.name.getText().
    • Fallback to <unknown> only if no name can be determined.
  2. In addDeprecatedSuggestionWithSignature:

    • Use the extracted method name for deprecated diagnostics when deprecatedEntity is falsy.
    • Retains correct behavior for both signature-level and declaration-level deprecation messages.

Problem Solved

  • Before: '(): ZodObject<{ compilerOptions: ZodAny; }, $loose>' is deprecated
  • After: 'passthrough()' is deprecated
  • The deprecation message now correctly shows the invoked method name instead of the type.

Related Issue

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Sep 5, 2025
@hanseul37 hanseul37 changed the title Fix(deprecation): report method name instead of type for deprecated methods (#62396) Fix(deprecation): report method name instead of type for deprecated methods #62396 Sep 5, 2025
@hanseul37 hanseul37 changed the title Fix(deprecation): report method name instead of type for deprecated methods #62396 Fix(deprecation): report method name instead of type for deprecated methods Sep 5, 2025
@hanseul37
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@hanseul37 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Sep 8, 2025
Copy link
Copy Markdown
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

This needs a test, but is probably wrong as it is casting nodes around to any to extract text. The fix should probably in the caller of addDeprecatedSuggestionWithSignature as that func is just a helper that automates adding a diagnostic.

@github-project-automation github-project-automation bot moved this from Not started to Waiting on author in PR Backlog Sep 8, 2025
@hanseul37 hanseul37 requested a review from jakebailey September 8, 2025 17:35
Copy link
Copy Markdown
Member

@RyanCavanaugh RyanCavanaugh left a comment

Choose a reason for hiding this comment

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

Please address the prior comment from Jake

@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

@github-project-automation github-project-automation bot moved this from Waiting on author to Done in PR Backlog Mar 24, 2026
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: Done

Development

Successfully merging this pull request may close these issues.

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

4 participants