getDefinitionAtPosition doesn't distinguish different kinds in a merged declaration
See original GitHub issueTypeScript Version: 2.7.2
Search Terms: getDefinitionAtPosition kind
Code
namespace A { export interface B {} }
class A {}
interface A {}
var x: A; // do getDefinitionAtPosition on the A reference here
Expected behavior:
In the result, each of the individual declarations should have the appropriate kind
:
[
{ fileName: 'test.ts', textSpan: { start: 10, length: 1 }, kind: 'module', name: 'A', ... },
{ fileName: 'test.ts', textSpan: { start: 44, length: 1 }, kind: 'class', name: 'A', ... },
{ fileName: 'test.ts', textSpan: { start: 59, length: 1 }, kind: 'interface', name: 'A', ... }
]
Actual behavior:
All declarations have the same kind
:
[
{ fileName: 'test.ts', textSpan: { start: 10, length: 1 }, kind: 'class', name: 'A', ... },
{ fileName: 'test.ts', textSpan: { start: 44, length: 1 }, kind: 'class', name: 'A', ... },
{ fileName: 'test.ts', textSpan: { start: 59, length: 1 }, kind: 'class', name: 'A', ... }
]
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Documentation - Declaration Merging - TypeScript
For the purposes of this article, “declaration merging” means that the compiler merges two separate declarations declared with the same name into a...
Read more >Merging Declarations in TypeScript | by John Au-Yeung
The process of declaration merging is the combining of multiple members from different sources with overlapping member names or types.
Read more >typescript - UNPKG
621, export interface Identifier extends PrimaryExpression, Declaration { ... 780, * Several node kinds share function-like features such as a signature,.
Read more >In defense of interface: Using declaration merging to disable ...
This post explains what declaration merging is, why it is, ... not merged; see Item 13: Know the Differences Between type and interface...
Read more >https://raw.githubusercontent.com/microsoft/TypeSc...
interface Push<T> { push(...values: T[]): void; } } declare namespace ts { export type Path = string & { __pathBrand: any; }; export...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You do not want to change this one. instead, when you have a definition you want to get its meaning, using
getMeaningFromLocation
and filtering the definitions you have to match the meaning you are looking for.See the use of
hasMatchingMeaning
in findAllRefernces.tsit has not, feel free to take it on!