Skip to content

Comments

fix(no-deprecated): detect deprecation on inherited methods with no child override#709

Merged
camc314 merged 3 commits intooxc-project:mainfrom
wagenet:fix/no-deprecated-inherited-methods
Feb 21, 2026
Merged

fix(no-deprecated): detect deprecation on inherited methods with no child override#709
camc314 merged 3 commits intooxc-project:mainfrom
wagenet:fix/no-deprecated-inherited-methods

Conversation

@wagenet
Copy link
Contributor

@wagenet wagenet commented Feb 21, 2026

Summary

In typescript-go, `Checker_getResolvedSignature` may not return a declaration for methods inherited from a base class when the child provides no override. The existing signature-based check silently produces no declaration, leaving the deprecation undetected.

  • Add `getJsDocDeprecation(aliasedSymbol)` as a fallback in the method/function branch of `getCallLikeDeprecation`, guarded by `signatureDecl == nil`. The guard ensures the fallback never fires for overloaded functions (which always resolve a concrete declaration), preventing false positives on non-deprecated overloads.

Test plan

  • `invalid-143`: `child.searchPaths()` where `Child extends Base {}` and `Base.searchPaths` is `@deprecated` — now flagged
  • `invalid-144`: same but with deprecation reason string (`deprecatedWithReason`)
  • `valid-22/23/25/26/29/33`: overloaded functions where only a non-deprecated overload is called — confirmed no regression

🤖 Generated with Claude Code

@wagenet wagenet force-pushed the fix/no-deprecated-inherited-methods branch from b4e7b7c to 0967c83 Compare February 21, 2026 00:33
…hild override

In typescript-go, `Checker_getResolvedSignature` may return a signature
without a declaration for methods inherited from a base class when the
child class does not override them. The existing signature-based check
would silently produce no declaration, leaving the fallback symbol check
as the only option.

Add `getJsDocDeprecation(aliasedSymbol)` as a fallback in the method/
function branch of `getCallLikeDeprecation`, guarded by `signatureDecl
== nil`. The guard ensures the fallback never fires for overloaded
functions (which always resolve a concrete signatureDecl), preventing
false positives on non-deprecated overloads.

Also add the `allDeclarationsAmbient` helper and `getDeprecatedPropertyInTypeChain`
recursive helper for a future fix to the `declare` re-declaration case
(Case 2), which is currently skipped pending typescript-go improvements
to base-type symbol resolution.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@wagenet wagenet force-pushed the fix/no-deprecated-inherited-methods branch from ad79056 to c0054fe Compare February 21, 2026 04:42
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

thank you!

@camc314 camc314 self-assigned this Feb 21, 2026
@camc314 camc314 enabled auto-merge (squash) February 21, 2026 13:17
@camc314 camc314 merged commit ea4e225 into oxc-project:main Feb 21, 2026
7 checks passed
@wagenet wagenet deleted the fix/no-deprecated-inherited-methods branch February 21, 2026 17:28
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.

2 participants