(
to: To,
transformation?: {
readonly decode: SchemaGetter.Getter<To["Encoded"], From["Type"], RD>
readonly encode: SchemaGetter.Getter<From["Type"], To["Encoded"], RE>
} | undefined
)
| 5578 | } |
| 5579 | ): (from: From) => decodeTo<To, From, RD, RE> |
| 5580 | export function decodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never>( |
| 5581 | to: To, |
| 5582 | transformation?: { |
| 5583 | readonly decode: SchemaGetter.Getter<To["Encoded"], From["Type"], RD> |
| 5584 | readonly encode: SchemaGetter.Getter<From["Type"], To["Encoded"], RE> |
| 5585 | } | undefined |
| 5586 | ) { |
| 5587 | return (from: From) => { |
| 5588 | return make( |
| 5589 | SchemaAST.decodeTo( |
| 5590 | from.ast, |
| 5591 | to.ast, |
| 5592 | transformation ? SchemaTransformation.make(transformation) : SchemaTransformation.passthrough() |
| 5593 | ), |
| 5594 | { |
| 5595 | from, |
| 5596 | to |
| 5597 | } |
| 5598 | ) |
| 5599 | } |
| 5600 | } |
| 5601 | |
| 5602 | /** |
| 5603 | * Applies a transformation to a schema, creating a new schema with the same type but transformed encoding/decoding. |
no test coverage detected