| 5731 | * @since 4.0.0 |
| 5732 | */ |
| 5733 | export function encode<S extends Constraint, RD = never, RE = never>(transformation: { |
| 5734 | readonly decode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RD> |
| 5735 | readonly encode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RE> |
| 5736 | }) { |
| 5737 | return (self: S): decodeTo<S, toEncoded<S>, RD, RE> => { |
| 5738 | return decodeTo<S, toEncoded<S>, RD, RE>(self, transformation)(toEncoded(self)) |
| 5739 | } |
| 5740 | } |
| 5741 | |
| 5742 | /** |
| 5743 | * Constraint used to ensure a schema field does not already have a constructor default. |