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

Function withDecodingDefaultType

repos/effect/packages/effect/src/Schema.ts:5871–5881  ·  view source on GitHub ↗
(
  defaultValue: Effect.Effect<S["Type"], SchemaError, R>,
  options?: DecodingDefaultOptions
)

Source from the content-addressed store, hash-verified

5869 options?: DecodingDefaultOptions
5870) {
5871 const encode = options?.encodingStrategy === "omit" ? SchemaGetter.omit() : SchemaGetter.passthrough()
5872 return (self: S): withDecodingDefaultKey<S, R> => {
5873 return optionalKey(toEncoded(self)).pipe(decodeTo(self, {
5874 decode: SchemaGetter.withDefault(toIssueEffect(defaultValue)),
5875 encode
5876 }))
5877 }
5878}
5879
5880/**
5881 * Type-level representation returned by {@link withDecodingDefaultTypeKey}.
5882 *
5883 * @category decoding
5884 * @since 4.0.0

Callers

nothing calls this directly

Calls 5

toTypeInterface · 0.85
encodeToFunction · 0.85
withDecodingDefaultFunction · 0.70
optionalInterface · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…