UNPKG

@ng-doc/builder

Version:

<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>

38 lines 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPropertyChain = getPropertyChain; const ts_morph_1 = require("ts-morph"); const class_1 = require("../class"); const interface_1 = require("../interface"); /** * * @param property */ function getPropertyChain(property) { const parent = property.getParent(); const name = property.getName(); const properties = []; if (ts_morph_1.Node.isClassDeclaration(parent)) { (0, class_1.forAllClasses)(parent, (cls) => { const prop = cls.getProperty(name); if (prop) { properties.push(prop); } }); // TODO: Add interfaces } else if (ts_morph_1.Node.isInterfaceDeclaration(parent)) { (0, interface_1.forAllInterfaces)(parent, (int) => { const prop = int.getProperty(name); if (prop) { properties.push(prop); } }); } else { // type aliases etc don't have inheritance, so we just add the property itself properties.push(property); } return properties; } //# sourceMappingURL=get-property-chain.js.map