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

Function decodeTo

packages/effect/src/Schema.ts:5737–5757  ·  view source on GitHub ↗
(
  to: To,
  transformation?: {
    readonly decode: SchemaGetter.Getter<To["Encoded"], From["Type"], RD>
    readonly encode: SchemaGetter.Getter<From["Type"], To["Encoded"], RE>
  } | undefined
)

Source from the content-addressed store, hash-verified

5735 }
5736): (from: From) => decodeTo<To, From, RD, RE>
5737export function decodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never>(
5738 to: To,
5739 transformation?: {
5740 readonly decode: SchemaGetter.Getter<To["Encoded"], From["Type"], RD>
5741 readonly encode: SchemaGetter.Getter<From["Type"], To["Encoded"], RE>
5742 } | undefined
5743) {
5744 return (from: From) => {
5745 return make(
5746 SchemaAST.decodeTo(
5747 from.ast,
5748 to.ast,
5749 transformation ? SchemaTransformation.makeTransformation(transformation) : SchemaTransformation.passthrough()
5750 ),
5751 {
5752 from,
5753 to
5754 }
5755 )
5756 }
5757}
5758
5759/**
5760 * Constructs a decode-only `SchemaAST.Link`.

Callers 15

transformFunction · 0.70
encodeKeysFunction · 0.70
extendToFunction · 0.70
ArrayEnsureFunction · 0.70
Schema.tsFile · 0.70
decodeFunction · 0.70
encodeToFunction · 0.70
encodeFunction · 0.70
withDecodingDefaultKeyFunction · 0.70
withDecodingDefaultFunction · 0.70
DefectFunction · 0.70
fromJsonStringFunction · 0.70

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected