Skip to content

Comments

fix(checker): mark getter/setter as deprecated when any declaration has @deprecated#63176

Closed
TheAbMehta wants to merge 1 commit intomicrosoft:mainfrom
TheAbMehta:fix/deprecated-getter-setter
Closed

fix(checker): mark getter/setter as deprecated when any declaration has @deprecated#63176
TheAbMehta wants to merge 1 commit intomicrosoft:mainfrom
TheAbMehta:fix/deprecated-getter-setter

Conversation

@TheAbMehta
Copy link

@TheAbMehta TheAbMehta commented Feb 21, 2026

Summary

Fixes #62965

@deprecated JSDoc tag on a getter or setter no longer marks the property as deprecated in completions or suggestion diagnostics when only one accessor of the pair has the tag. This is a regression introduced in #41941.

Problem

Getter/setter pairs share a single symbol with two declarations. PR #41941 changed the deprecation check to require all declarations to be deprecated (using every()), which is correct for function overloads but incorrect for accessor pairs. If only the getter has @deprecated, the property should still appear deprecated when reading it — and vice versa for the setter.

Three locations needed fixing:

  1. src/compiler/checker.tsisDeprecatedSymbol(): For symbols with SymbolFlags.Accessor, use some() instead of every() to check declarations, matching the existing behavior for interface members.

  2. src/services/completions.tsisDeprecated(): Same fix — use some() for accessor symbols so completion items get the deprecated sort text.

  3. src/services/symbolDisplay.tsgetNormalizedSymbolModifiers(): The existing logic strips the deprecated modifier when the first declaration is deprecated but others aren't. For accessor symbols, re-add the deprecated modifier if any declaration has @deprecated.

Tests

  • completionsWithDeprecatedGetterSetter.ts — verifies deprecated kindModifiers and sortText in completions for getter/setter pairs where only one accessor has @deprecated
  • jsdocDeprecated_suggestionGetterSetter.ts — verifies suggestion diagnostics (strikethrough) for the same scenarios

All existing completionsWithDeprecatedTag* and jsdocDeprecated_suggestion* tests continue to pass.

Disclosure

This PR was authored with the assistance of Claude (LLM) to help understand the codebase and structure the implementation and description.

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Feb 21, 2026
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Feb 21, 2026
@TheAbMehta
Copy link
Author

@microsoft-github-policy-service agree

@TheAbMehta TheAbMehta closed this Feb 22, 2026
@TheAbMehta TheAbMehta deleted the fix/deprecated-getter-setter branch February 22, 2026 04:54
@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Feb 22, 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.

@deprecated on property getter and setters.

2 participants