Skip to content

andThen

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

Defined in: Core/Optional.ts:173

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>

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