lensOptionalProp()
lensOptionalProp<
T
>(): <K
>(prop
) =>Lens
<T
,undefined
|T
[K
]>
Short-hand to create is simplistic, optional, get/set lens.
Type Parameters
T
T
extends object
The type of the object being inspected.
Returns
<
K
>(prop
):Lens
<T
,undefined
|T
[K
]>
Type Parameters
K
K
extends string
| number
| symbol
Parameters
prop
K
Returns
Lens
<T
, undefined
| T
[K
]>
Remarks
pure function
Example
const { get, set } = lensOptionalProp<Person>()('name');