import { JSIndexer } from './js-indexer.js';
export class TypeScriptIndexer extends JSIndexer {
    constructor() {
        super(...arguments);
        this.language = 'typescript';
        // extractImports and extractCalls are mostly same as JS for TS
    }
    extractExports(root, filePath) {
        const exports = super.extractExports(root, filePath);
        const addExport = (name, type, node) => {
            exports.push({
                name,
                type,
                filePath,
                line: node.startPosition.row + 1,
                column: node.startPosition.column + 1,
                parameters: this.extractParameters(node)
            });
        };
        // 1. Interfaces
        const interfaceNodes = root.descendantsOfType('interface_declaration');
        for (const node of interfaceNodes) {
            const nameNode = node.childForFieldName('name');
            if (nameNode)
                addExport(nameNode.text, 'interface', node);
        }
        // 2. Types
        const typeNodes = root.descendantsOfType('type_alias_declaration');
        for (const node of typeNodes) {
            const nameNode = node.childForFieldName('name');
            if (nameNode)
                addExport(nameNode.text, 'type', node);
        }
        return exports;
    }
}
//# sourceMappingURL=typescript-indexer.js.map