@internal
()
| 1425 | } |
| 1426 | /** @internal */ |
| 1427 | toCodecStringTree(): AST { |
| 1428 | if (this.enums.some(([_, v]) => typeof v === "number")) { |
| 1429 | const coercions = Object.fromEntries(this.enums.map(([_, v]) => [globalThis.String(v), v])) |
| 1430 | return replaceEncoding(this, [ |
| 1431 | new Link( |
| 1432 | new Union(Object.keys(coercions).map((k) => new Literal(k))), |
| 1433 | new SchemaTransformation.Transformation( |
| 1434 | SchemaGetter.transform((s) => coercions[s]), |
| 1435 | SchemaGetter.String() |
| 1436 | ) |
| 1437 | ) |
| 1438 | ]) |
| 1439 | } |
| 1440 | return this |
| 1441 | } |
| 1442 | /** @internal */ |
| 1443 | getExpected(): string { |
| 1444 | return this.enums.map(([_, value]) => JSON.stringify(value)).join(" | ") |
nothing calls this directly
no test coverage detected