MCPcopy Create free account
hub / github.com/Effect-TS/effect / encode

Function encode

packages/effect/src/Schema.ts:5922–5929  ·  view source on GitHub ↗
(transformation: {
  readonly decode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RD>
  readonly encode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RE>
})

Source from the content-addressed store, hash-verified

5920 * @since 4.0.0
5921 */
5922export function encode<S extends Constraint, RD = never, RE = never>(transformation: {
5923 readonly decode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RD>
5924 readonly encode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RE>
5925}) {
5926 return (self: S): decodeTo<S, toEncoded<S>, RD, RE> => {
5927 return decodeTo<S, toEncoded<S>, RD, RE>(self, transformation)(toEncoded(self))
5928 }
5929}
5930/**
5931 * Constraint used to ensure a schema field does not already have a constructor default.
5932 *

Callers 3

netAddressFromStringFunction · 0.70
cardActivityFunction · 0.50

Calls 2

decodeToFunction · 0.70
toEncodedInterface · 0.70

Tested by

no test coverage detected