MCPcopy
hub / github.com/Effect-TS/effect / optionalToOptional

Function optionalToOptional

packages/effect/src/Schema.ts:2305–2320  ·  view source on GitHub ↗
(
  from: Schema<FA, FI, FR>,
  to: Schema<TA, TI, TR>,
  options: {
    readonly decode: (o: option_.Option<FA>) => option_.Option<TI>
    readonly encode: (o: option_.Option<TI>) => option_.Option<FA>
  }
)

Source from the content-addressed store, hash-verified

2303 * @since 3.10.0
2304 */
2305export const optionalToOptional = <FA, FI, FR, TA, TI, TR>(
2306 from: Schema<FA, FI, FR>,
2307 to: Schema<TA, TI, TR>,
2308 options: {
2309 readonly decode: (o: option_.Option<FA>) => option_.Option<TI>
2310 readonly encode: (o: option_.Option<TI>) => option_.Option<FA>
2311 }
2312): PropertySignature<"?:", TA, never, "?:", FI, false, FR | TR> =>
2313 makePropertySignature(
2314 new PropertySignatureTransformation(
2315 new FromPropertySignature(from.ast, true, true, {}, undefined),
2316 new ToPropertySignature(to.ast, true, true, {}, undefined),
2317 options.decode,
2318 options.encode
2319 )
2320 )
2321
2322/**
2323 * @since 3.10.0

Callers 1

Calls 1

makePropertySignatureFunction · 0.85

Tested by

no test coverage detected