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

Function withDecodingDefaultType

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

Source from the content-addressed store, hash-verified

6240 * @since 4.0.0
6241 */
6242export function withDecodingDefaultType<S extends Constraint, R = never>(
6243 defaultValue: Effect.Effect<S["Type"], SchemaError, R>,
6244 options?: DecodingDefaultOptions
6245): (self: S) => withDecodingDefaultType<S, R> {
6246 return (self: S): withDecodingDefaultType<S, R> => {
6247 return toType(self).pipe(
6248 withDecodingDefault<toType<S>, R>(defaultValue, options),
6249 encodeTo(optional(self))
6250 )
6251 }
6252}
6253/**
6254 * Type-level representation returned by {@link tag}.
6255 *

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected