UNPKG

@sinclair/typebox

Version:

Json Schema Type Builder with Static Type Resolution for TypeScript

15 lines (13 loc) 563 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TemplateLiteralToUnion = void 0; const index_1 = require("../union/index"); const index_2 = require("../literal/index"); const generate_1 = require("./generate"); /** Returns a Union from the given TemplateLiteral */ function TemplateLiteralToUnion(schema) { const R = (0, generate_1.TemplateLiteralGenerate)(schema); const L = R.map((S) => (0, index_2.Literal)(S)); return (0, index_1.UnionEvaluated)(L); } exports.TemplateLiteralToUnion = TemplateLiteralToUnion;