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

Function decode

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

Source from the content-addressed store, hash-verified

5642 * @since 4.0.0
5643 */
5644export function decode<S extends Constraint, RD = never, RE = never>(transformation: {
5645 readonly decode: SchemaGetter.Getter<S["Type"], S["Type"], RD>
5646 readonly encode: SchemaGetter.Getter<S["Type"], S["Type"], RE>
5647}) {
5648 return (self: S): decodeTo<toType<S>, S, RD, RE> => {
5649 return decodeTo<toType<S>, S, RD, RE>(toType(self), transformation)(self)
5650 }
5651}
5652
5653/**
5654 * Reverses a schema transformation so the encoded schema is supplied first.

Callers 1

decodeFromCursorFunction · 0.70

Calls 2

toTypeInterface · 0.85
decodeToFunction · 0.70

Tested by

no test coverage detected