dgeni-packages
Version:
A collection of dgeni packages for generating documentation from source code
31 lines • 2.16 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PropertyMemberDoc = void 0;
const AccessorInfoDoc_1 = require("./AccessorInfoDoc");
const MemberDoc_1 = require("./MemberDoc");
class PropertyMemberDoc extends MemberDoc_1.MemberDoc {
constructor(host, containerDoc, symbol, declaration, getAccessorDeclaration, setAccessorDeclaration) {
// For accessors, the declaration parameter will be null, and therefore the getter declaration
// will be used for most of the things (e.g. determination of the type). If the getter doesn't
// have a type or description, the setter will be checked manually later in this constructor.
super(host, containerDoc, symbol, (declaration || getAccessorDeclaration || setAccessorDeclaration));
this.name = this.symbol.name;
this.anchor = this.name;
this.id = `${this.containerDoc.id}.${this.name}`;
this.aliases = [this.name].concat(this.containerDoc.aliases.map(alias => `${alias}.${this.name}`));
// If this property has accessors then compute the type based on that instead
this.getAccessor = getAccessorDeclaration && new AccessorInfoDoc_1.AccessorInfoDoc(host, 'get', this, getAccessorDeclaration);
this.setAccessor = setAccessorDeclaration && new AccessorInfoDoc_1.AccessorInfoDoc(host, 'set', this, setAccessorDeclaration);
// As mentioned before, by default the get accessor declaration will be passed to the superclass,
// to determine information about the property. With that approach, it can happen that a few
// things are not declared on the getter, but on the setter. In that case, if there is a
// setter, we add the missing information by looking at the setter info document.
if (this.setAccessor) {
this.type = this.type || this.setAccessor.parameterDocs[0].type || '';
this.content = this.content || this.setAccessor.content || '';
this.decorators = this.decorators || this.setAccessor.decorators;
}
}
}
exports.PropertyMemberDoc = PropertyMemberDoc;
//# sourceMappingURL=PropertyMemberDoc.js.map