MCPcopy Create free account
hub / github.com/effect-app/libs / optionalKey

Method optionalKey

repos/effect/packages/effect/src/Optic.ts:617–617  ·  view source on GitHub ↗

* Focuses on a key where setting `undefined` **removes** the key from the * struct (or splices the element from an array/tuple). * * **Details** * * - The focus type becomes `A[Key] | undefined`. * - Does **not** work on union types (compile error). * * **Example** (Deleting

(
    this: Lens<S, A>,
    key: Key,
    ..._err: ForbidUnion<A, "cannot use `optionalKey` on a union type">
  )

Source from the content-addressed store, hash-verified

615 * { expected: `"b" tag` }
616 * )
617 *
618 * _b.getResult({ _tag: "b", b: 1 }) // => Result.succeed({ _tag: "b", b: 1 })
619 * ```
620 *

Callers 15

optionalOptionFunction · 0.65
special.test.tsFile · 0.65
makeExactOptionalFunction · 0.65
OpenApiPatch.tsFile · 0.65
OpenApi.test.tsFile · 0.65
HttpApi.test.tsFile · 0.65
Generated.tsFile · 0.65

Implementers 1

OptionalImplrepos/effect/packages/effect/src/Optic

Calls

no outgoing calls

Tested by 2

fFunction · 0.52