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

Method optionalKey

packages/effect/src/Optic.ts:566–566  ·  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

564 * ```
565 */
566 optionalKey<S, A extends object, Key extends keyof A>(
567 this: Lens<S, A>,
568 key: Key,
569 ..._err: ForbidUnion<A, "cannot use `optionalKey` on a union type">

Callers 15

OpenApiPatch.tsFile · 0.65
shared.graphql.tsFile · 0.65
optionalFunction · 0.65
WhatsAppUpdate.tsFile · 0.65
envelope.tsFile · 0.65
auth.tsFile · 0.65
AnthropicTool.tsFile · 0.65
Generated.tsFile · 0.65
OpenAiSchema.tsFile · 0.65
OpenAiClient.tsFile · 0.65

Implementers 1

OptionalImplpackages/effect/src/Optic.ts

Calls

no outgoing calls

Tested by 2

transformFunction · 0.52
fFunction · 0.52