MCPcopy Create free account
hub / github.com/effect-app/libs / encode

Function encode

repos/effect/packages/effect/src/Schema.ts:5562–5569  ·  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

5560 * In a custom transformation, `decode` maps `From["Type"]` to `To["Encoded"]`
5561 * and is used on the encoding path, while `encode` maps `To["Encoded"]` to
5562 * `From["Type"]` and is used on the decoding path.
5563 *
5564 * **Example** (Transforming strings to numbers with a schema transformation)
5565 *
5566 * ```ts import.meta.vitest
5567 * import { Schema, SchemaGetter } from "effect"
5568 *
5569 * const NumberFromString = Schema.String.pipe(
5570 * Schema.decodeTo(
5571 * Schema.Number,
5572 * {

Callers 8

createRandomInstanceIFunction · 0.50
makeSSEFunction · 0.50
special.test.tsFile · 0.50
Sse.test.tsFile · 0.50
Rpc.test.tsFile · 0.50
Schema.test.tsFile · 0.50
toSchema.test.tsFile · 0.50

Calls 2

toEncodedInterface · 0.85
decodeToFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…