"Find All References" shows all interface implementations instead of specific class method references #61484
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
When using VS Code's "Find All References" on a class method that implements an interface method, the results include all instances where the method is defined (e.g., in the interface and other implementing classes). However, I expected it to show only references specific to the selected class implementation.
Steps to Reproduce:
transform
method inside theBar
class.transform
, including the interface definition and the implementation inBaz
.Expected Behavior:
VS Code should return only the references specific to
Bar
's implementation oftransform
.Actual Behavior:
The search includes all references to
transform
across the interface and other implementations, making it difficult to isolate usages ofBar.transform
.Impact on "inferFromUsage"
The behavior also affects TypeScript's "inferFromUsage" feature:
Since
Bar.transform(1)
is explicitly called, TypeScript infersvalue
as anumber
. However,Baz.transform
also gets the same inferred type even though it's never used. This suggests that TypeScript applies inference across all implementations of the interface, rather than treating them independently.[🔗 TypeScript AST Viewer](https://ts-ast-viewer.com/#code/KYDwDg9gTgLgBAE2AYwDYEMrDgSwHYzBQBm6y2AKlOngM7HQC2cA3gFBydwzV0NSMAFADd0qAK7AAXHBoBPADRwAdKswBzWjPkBtALoBKbXjkBuNgF82bUJFhw06WrTgAhTLkZhUwRsAIuVDT0TKwcXDzB-EKiEsAGrHBWVjbg0PCOzm7oAF6e3r7+MIG8IQJhXNyl0SJikgksSZbWeMAA7tlQggbKkXxMggCMBuZAA)
The text was updated successfully, but these errors were encountered: