Function optionalLens

Creates a lens for optional properties that may be missing or null.

  • Type Parameters

    • T

      The parent object type.

    • U

      The property type.

    Parameters

    • getter: ((obj: T) => U)

      Function to get the property or return null.

        • (obj): U
        • Parameters

          • obj: T

          Returns U

    • setter: ((value: U, obj: T) => T)

      Function to set the property immutably.

        • (value, obj): T
        • Parameters

          • value: U
          • obj: T

          Returns T

    Returns OptionalLens<T, U>