Skip to content

andThenOptional

andThenOptional<A, B>(inner): <S>(outer) => Optional<S, B>

Defined in: Core/Lens.ts:123

Composes a Lens with an Optional, producing an Optional. Use when the next step in the focus is optional (may be absent).

A

B

Optional<A, B>

<S>(outer): Optional<S, B>

S

Lens<S, A>

Optional<S, B>

const userBioOpt = pipe(
  Lens.prop<User>()("profile"),
  Lens.andThenOptional(Optional.prop<Profile>()("bio")),
);