fix(extraction): extract type refs from TS interface property and method signatures (#432)
Types that appeared only in TypeScript interface members — property signatures like `value?: Partial<IPage>` and method signatures like `fetchPage(arg: IPage): IOrderField` — were not being captured at extraction time, so the resolver never built `references` edges for them. `codegraph_impact`/`codegraph_callers` on the named type missed every consumer that imported it solely to use it in an interface shape. Add a `property_signature` / `method_signature` branch in `visitNode`: when inside a class-like node (which covers interfaces) and the language supports type annotations, call `extractTypeAnnotations` with the parent (interface) node ID as the edge source. No property/method node is created — only unresolved references that the resolver wires the same way it wires field and parameter type references elsewhere.
This commit is contained in:
@@ -387,6 +387,22 @@ export class TreeSitterExtractor {
|
||||
else if (nodeType === 'impl_item') {
|
||||
this.extractRustImplItem(node);
|
||||
}
|
||||
// TypeScript interface members: property_signature (`foo: T`, `foo?: T`)
|
||||
// and method_signature (`foo(arg: A): R`) both carry type annotations the
|
||||
// interface walker would otherwise drop. Extract them as `references`
|
||||
// edges from the interface so resolvers can wire callers/impact for
|
||||
// types that only appear in interface members.
|
||||
else if (
|
||||
(nodeType === 'property_signature' || nodeType === 'method_signature') &&
|
||||
this.isInsideClassLikeNode() &&
|
||||
this.TYPE_ANNOTATION_LANGUAGES.has(this.language)
|
||||
) {
|
||||
const parentId = this.nodeStack[this.nodeStack.length - 1];
|
||||
if (parentId) {
|
||||
this.extractTypeAnnotations(node, parentId);
|
||||
}
|
||||
// don't skipChildren — nested signatures still need traversal
|
||||
}
|
||||
|
||||
// Visit children (unless the extract method already visited them)
|
||||
if (!skipChildren) {
|
||||
|
||||
Reference in New Issue
Block a user