Skip to content

andThen

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

Defined in: Core/Optional.ts:190

Composes two Optionals: focuses through the outer, then through the inner. Returns None if either focus is absent.

A

B

Optional<A, B>

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

S

Optional<S, A>

Optional<S, B>

const deepOpt = pipe(
  Optional.prop<User>()("address"),
  Optional.andThen(Optional.prop<Address>()("landmark")),
);