* 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">
)
| 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"> |
no outgoing calls