type2docfx
Version:
A tool to convert json format output from TypeDoc to schema driven reference model for DocFx to consume.
65 lines • 2.63 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccessorConverter = void 0;
var base_1 = require("./base");
var idResolver_1 = require("../idResolver");
var AccessorConverter = /** @class */ (function (_super) {
__extends(AccessorConverter, _super);
function AccessorConverter() {
return _super !== null && _super.apply(this, arguments) || this;
}
AccessorConverter.prototype.generate = function (node, context) {
var uid = context.ParentUid + '.' + node.name;
console.log(" - " + node.kindString + ": " + uid);
var signatureType;
if (node.getSignature) {
if (Array.isArray(node.getSignature)) {
signatureType = node.getSignature[0].type;
}
else {
signatureType = node.getSignature.type;
}
}
else if (node.setSignature) {
if (Array.isArray(node.setSignature)) {
signatureType = node.setSignature[0].type;
}
else {
signatureType = node.setSignature.type;
}
}
var model = {
uid: uid,
name: node.name,
fullName: node.name,
children: [],
langs: ['typeScript'],
type: 'property',
summary: node.comment ? this.findDescriptionInComment(node.comment) : '',
syntax: {
content: "" + (node.flags && node.flags.isStatic ? 'static ' : '') + idResolver_1.typeToString(this.extractType(signatureType)[0]) + " " + node.name,
return: {
type: this.extractType(signatureType),
description: this.extractReturnComment(node.comment)
}
}
};
return [model];
};
return AccessorConverter;
}(base_1.AbstractConverter));
exports.AccessorConverter = AccessorConverter;
//# sourceMappingURL=accessor.js.map