dgeni-packages
Version:
A collection of dgeni packages for generating documentation from source code
27 lines • 1.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FunctionExportDoc = void 0;
const getDeclarationTypeText_1 = require("../services/TsParser/getDeclarationTypeText");
const OverloadInfo_1 = require("./OverloadInfo");
const ParameterContainer_1 = require("./ParameterContainer");
const ParameterizedExportDoc_1 = require("./ParameterizedExportDoc");
class FunctionExportDoc extends ParameterizedExportDoc_1.ParameterizedExportDoc {
constructor(host, containerDoc, symbol, aliasSymbol) {
super(host, containerDoc, symbol, findRealDeclaration(symbol.getDeclarations()), aliasSymbol);
this.containerDoc = containerDoc;
this.docType = 'function';
this.type = (0, getDeclarationTypeText_1.getDeclarationTypeText)(this.declaration);
this.overloads = this.symbol.getDeclarations()
.filter(declaration => declaration !== this.declaration)
.map(declaration => new OverloadInfo_1.OverloadInfo(this, declaration));
this.parameterDocs = (0, ParameterContainer_1.getParameters)(this);
this.parameters = this.parameterDocs.map(p => p.paramText);
}
}
exports.FunctionExportDoc = FunctionExportDoc;
function findRealDeclaration(declarations) {
// For this container doc, we use the declaration that has a body or just the first given
// declaration
return declarations.find(declaration => !!declaration.body) || declarations[0];
}
//# sourceMappingURL=FunctionExportDoc.js.map