From ce7b7684dbe3e1fb109680e44e2d8cd762d81091 Mon Sep 17 00:00:00 2001 From: Colby McHenry Date: Mon, 6 Apr 2026 21:13:57 -0500 Subject: [PATCH] feat: Fix TypeScript inheritance extraction by properly handling class_heritage wrapper nodes Addresses TypeScript's AST structure where class_heritage nodes wrap extends_clause and implements_clause rather than directly indicating inheritance relationships. Moves class_heritage from direct inheritance extraction to recursive container processing to properly traverse the wrapped inheritance syntax. --- src/extraction/tree-sitter.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extraction/tree-sitter.ts b/src/extraction/tree-sitter.ts index b8edca5..6f6f4b5 100644 --- a/src/extraction/tree-sitter.ts +++ b/src/extraction/tree-sitter.ts @@ -1214,7 +1214,6 @@ export class TreeSitterExtractor { if ( child.type === 'extends_clause' || - child.type === 'class_heritage' || child.type === 'superclass' || child.type === 'extends_interfaces' // Java interface extends ) { @@ -1329,8 +1328,9 @@ export class TreeSitterExtractor { } } - // Recurse into container nodes (e.g. field_declaration_list in Go structs) - if (child.type === 'field_declaration_list') { + // Recurse into container nodes (e.g. field_declaration_list in Go structs, + // class_heritage in TypeScript which wraps extends_clause/implements_clause) + if (child.type === 'field_declaration_list' || child.type === 'class_heritage') { this.extractInheritance(child, classId); } }