dilswer
Version:
Blazingly fast data validation library with TypeScript integration.
27 lines (26 loc) • 727 B
JavaScript
// src/ts-type-generator/type-builders/enum-builder.ts
import { TemplateBuilder } from "../template-builder.mjs";
import { TsBaseBuilder } from "./base-builder.mjs";
var ENUM_EXPORT_TEMPLATE = new TemplateBuilder(`{{description}}
{{export}}type {{name}} = {{type}};`);
var TsEnumBuilder = class extends TsBaseBuilder {
constructor(enumName) {
super();
this.enumName = enumName;
}
build() {
return this.enumName;
}
buildExport(type) {
var _a;
return ENUM_EXPORT_TEMPLATE.build({
description: this.description,
name: (_a = this.name) != null ? _a : this.generateName("Enum"),
type: this.enumName,
export: this.parseExportType(type)
});
}
};
export {
TsEnumBuilder
};