Import
import { filterMap } from "@typed/guard";Signatures
export declare const filterMap: {
<O, B>(f: (o: O) => Option.Option<B>): <I, R, E>(guard: GuardInput<I, O, E, R>) => Guard<I, B, E, R>;
<I, O, E, R, B>(guard: GuardInput<I, O, E, R>, f: (o: O) => Option.Option<B>): Guard<I, B, E, R>;
};Why
Option.none provides a second ordinary non-match stage without introducing typed failure.
Ownership and lifetime
This combinator acquires no resources; the callback runs only for source matches.
Examples
import { filterMap, liftPredicate } from "@typed/guard"
import { Option } from "effect"
const parsed = filterMap(liftPredicate((u: unknown): u is string => typeof u === "string"), (s) => s ? Option.some(Number(s)) : Option.none())