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

Function withDecodingDefaultTypeKey

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

Source from the content-addressed store, hash-verified

6128 * @since 4.0.0
6129 */
6130export function withDecodingDefaultTypeKey<S extends Constraint, R = never>(
6131 defaultValue: Effect.Effect<S["Type"], SchemaError, R>,
6132 options?: DecodingDefaultOptions
6133): (self: S) => withDecodingDefaultTypeKey<S, R> {
6134 return (self: S): withDecodingDefaultTypeKey<S, R> => {
6135 return toType(self).pipe(
6136 withDecodingDefaultKey<toType<S>, R>(defaultValue, options),
6137 encodeTo(optionalKey(self))
6138 )
6139 }
6140}
6141/**
6142 * Type-level representation returned by {@link withDecodingDefault}.
6143 *

Callers

nothing calls this directly

Calls 5

encodeToFunction · 0.85
optionalKeyInterface · 0.85
toTypeInterface · 0.70
withDecodingDefaultKeyFunction · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected