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

Function withDecodingDefaultTypeKey

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

Source from the content-addressed store, hash-verified

5931 * @since 4.0.0
5932 */
5933export function withDecodingDefaultTypeKey<S extends Constraint, R = never>(
5934 defaultValue: Effect.Effect<S["Type"], SchemaError, R>,
5935 options?: DecodingDefaultOptions
5936) {
5937 return (self: S): withDecodingDefaultTypeKey<S, R> => {
5938 return toType(self).pipe(
5939 withDecodingDefaultKey<toType<S>, R>(defaultValue, options),
5940 encodeTo(optionalKey(self))
5941 )
5942 }
5943}
5944
5945/**
5946 * Type-level representation returned by {@link withDecodingDefault}.

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected