UNPKG

dilswer

Version:

Blazingly fast data validation library with TypeScript integration.

73 lines (71 loc) 1.77 kB
var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); // src/ts-type-generator/type-builders/type-reference.ts var TsTypeReference = class _TsTypeReference { constructor(fileScope, type, name) { this.fileScope = fileScope; this.type = type; this.name = name; __publicField(this, "isTitled", false); __publicField(this, "isAddedToScope", true); } static resolveReference(reference) { let b = reference; while (b instanceof _TsTypeReference) { b = b.type; } return b; } getDescription(indent) { return this.type.getDescription(indent); } setName(name) { this.fileScope.changeReferenceName(this, name); } getName() { return this.name; } build() { return this.name; } buildExport(type) { switch (type) { case "export": case "export/declare": return `export type { ${this.name} };`; } return void 0; } }; var TsNamedReference = class { constructor(name) { this.name = name; __publicField(this, "isTitled", false); __publicField(this, "isAddedToScope", true); } getDescription() { return ""; } setName() { throw new Error("Cannot set name of a named reference."); } getName() { return this.name; } build() { return this.name; } buildExport(type) { switch (type) { case "export": case "export/declare": return `export type { ${this.name} };`; } return void 0; } }; export { TsNamedReference, TsTypeReference };