Type alias Getter<T>

Getter<T>: {
    get: (() => T);
    k: (<K>(key: K) => Getter<PickReturn<T, K>>);
}

Return type of the toGetter function. Like OptionalLens, a Getter<T> can be used for optional chaining on arbitrary union types. In contrast to OptionalLens, the initial Getter<T> must be obtained from a value of type T. You can thus use it as kind of ad-hoc lens for a one-time access. In most cases however, using an OptionalLens is the better choice.

See toGetter documentation for example usage.

Type Parameters

  • T

Type declaration

Generated using TypeDoc