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

Method optionalKey

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

554 * ```
555 */
556 optionalKey<S, A extends object, Key extends keyof A>(
557 this: Lens<S, A>,
558 key: Key,
559 ..._err: ForbidUnion<A, "cannot use `optionalKey` on a union type">

Callers 15

OpenApiPatch.tsFile · 0.65
AnthropicTool.tsFile · 0.65
Generated.tsFile · 0.65
OpenAiSchema.tsFile · 0.65
OpenAiClient.tsFile · 0.65
OpenApi.test.tsFile · 0.65
HttpApi.test.tsFile · 0.65
Optic.tst.tsFile · 0.65
Schema.tst.tsFile · 0.65
Struct.tst.tsFile · 0.65
Tuple.tst.tsFile · 0.65

Implementers 1

OptionalImplpackages/effect/src/Optic.ts

Calls

no outgoing calls

Tested by 1

fFunction · 0.52