clasp-types
Version:
A d.ts generator for clasp projects
35 lines (34 loc) • 1.48 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.Enum = void 0;
var Definition_1 = require("./Definition");
var EnumProperty_1 = require("./EnumProperty");
var Enum = /** @class */ (function (_super) {
__extends(Enum, _super);
function Enum(kind, depth) {
return _super.call(this, kind, depth) || this;
}
Enum.prototype.render = function (builder) {
var _this = this;
this.addComment(builder, this.kind.comment);
var props = this.kind.children.map(function (k) { return new EnumProperty_1.EnumProperty(k, _this.tab()); });
builder.append(this.ident() + "export enum " + this.kind.name + " {").doubleLine();
props.forEach(function (p) { return p.render(builder); });
builder.append(this.ident() + "}").doubleLine();
};
return Enum;
}(Definition_1.Definition));
exports.Enum = Enum;