Import
import { tap } from "@typed/guard";Signatures
export declare const tap: {
<O>(f: (o: O) => void): <I, R, E>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E, R>;
<O, B, E2, R2>(f: (o: O) => Effect.Effect<B, E2, R2>): <I, R, E>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E | E2, R | R2>;
<I, O, E, R>(guard: GuardInput<I, O, E, R>, f: (o: O) => void): Guard<I, O, E, R>;
<I, O, E, R, B, E2, R2>(guard: GuardInput<I, O, E, R>, f: (o: O) => Effect.Effect<B, E2, R2>): Guard<I, O, E | E2, R | R2>;
};Why
Observation composes without changing output, while Effect callbacks correctly contribute their errors and services.
Ownership and lifetime
Construction acquires no resources; callback lifetime is bounded by each matching Guard invocation.
Examples
import { liftPredicate, tap } from "@typed/guard"
const observed = tap(liftPredicate((u: unknown): u is string => typeof u === "string"), console.log)