(
to: To,
transformation?: {
readonly decode: SchemaGetter.Getter<From["Encoded"], To["Type"], RD>
readonly encode: SchemaGetter.Getter<To["Type"], From["Encoded"], RE>
}
)
| 5691 | } |
| 5692 | ): (from: From) => decodeTo<From, To, RD, RE> |
| 5693 | export function encodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never>( |
| 5694 | to: To, |
| 5695 | transformation?: { |
| 5696 | readonly decode: SchemaGetter.Getter<From["Encoded"], To["Type"], RD> |
| 5697 | readonly encode: SchemaGetter.Getter<To["Type"], From["Encoded"], RE> |
| 5698 | } |
| 5699 | ) { |
| 5700 | return (from: From): decodeTo<From, To, RD, RE> => { |
| 5701 | return transformation ? |
| 5702 | decodeTo<From, To, RD, RE>(from, transformation)(to) : |
| 5703 | decodeTo<From>(from)(to) |
| 5704 | } |
| 5705 | } |
| 5706 | |
| 5707 | /** |
| 5708 | * Applies a transformation to a schema's encoded type, creating a new schema where encoding/decoding |
no test coverage detected