Hyperlinkv0.8.0-beta.28

Schema

Schema.linkfunctioneffect/Schema.ts:6374
<T>(): <To extends Constraint>(
  encodeTo: To,
  transformation: {
    readonly decode: SchemaGetter.Getter<T, NoInfer<To["Type"]>>
    readonly encode: SchemaGetter.Getter<NoInfer<To["Type"]>, T>
  }
) => SchemaAST.Link

Constructs an SchemaAST.Link that describes how a value of type T encodes to and decodes from a To schema. Used when building low-level AST transformations that bridge two schema types.

transforming
Source effect/Schema.ts:637411 lines
export function link<T>() {
  return <To extends Constraint>(
    encodeTo: To,
    transformation: {
      readonly decode: SchemaGetter.Getter<T, NoInfer<To["Type"]>>
      readonly encode: SchemaGetter.Getter<NoInfer<To["Type"]>, T>
    }
  ): SchemaAST.Link => {
    return new SchemaAST.Link(encodeTo.ast, SchemaTransformation.make(transformation))
  }
}
Referenced by 27 symbols