typescript-member-signatures
Version:
Command line tool to extract given interface member signatures as JSON strings, recursively in the extends chain with the purpose of documentation
22 lines • 960 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = require("assert");
const cannabis_1 = require("cannabis");
const misc_utils_of_mine_generic_1 = require("misc-utils-of-mine-generic");
const ts_morph_1 = require("ts-morph");
const getProject_1 = require("./getProject");
function listInterfaces(o) {
const root = getProject_1.getProject(o);
const query = `//InterfaceDeclaration ${o.target ? `[matchEvery(@namePath, '${o.target}')]` : ''}`;
o.debug && console.log('Executing Query : ' + query);
const r = cannabis_1.queryAst(query, root);
if (r.error) {
assert_1.fail(r.error);
}
return r.result.filter(ts_morph_1.TypeGuards.isInterfaceDeclaration).filter(misc_utils_of_mine_generic_1.notUndefined).map(i => ({
name: i.getName(),
path: cannabis_1.getASTNodeNamePath(i)
}));
}
exports.listInterfaces = listInterfaces;
//# sourceMappingURL=printInterfaces.js.map