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

Function withDecodingDefaultType

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

Source from the content-addressed store, hash-verified

6043 * @since 4.0.0
6044 */
6045export function withDecodingDefaultType<S extends Constraint, R = never>(
6046 defaultValue: Effect.Effect<S["Type"], SchemaError, R>,
6047 options?: DecodingDefaultOptions
6048) {
6049 return (self: S): withDecodingDefaultType<S, R> => {
6050 return toType(self).pipe(
6051 withDecodingDefault<toType<S>, R>(defaultValue, options),
6052 encodeTo(optional(self))
6053 )
6054 }
6055}
6056
6057/**
6058 * Type-level representation returned by {@link tag}.

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