variable / @typed/fx/Versioned

filterMap

Filter-maps a Versioned’s output as both an Fx and Effect; the Effect value becomes Option (Some when the predicate holds, None otherwise).

Package version
2.0.0-beta.13
Category
Optional channel transformations
Since
1.18.0

Import

import { filterMap } from "@typed/fx/Versioned";

Signatures

export declare const filterMap: {
    <A, E, R, C, B, D>(options: {
        onFx: (a: A) => Option.Option<C>;
        onEffect: (b: B) => Option.Option<D>;
    }): <R0, E0, R2, E2>(versioned: Versioned<R0, E0, A, E, R, B, E2, R2>) => Versioned<never, never, C, E, R, Option.Option<D>, E0 | E2, R0 | R2>;
    <R0, E0, A, E, R, B, E2, R2, C, D>(versioned: Versioned<R0, E0, A, E, R, B, E2, R2>, options: {
        onFx: (a: A) => Option.Option<C>;
        onEffect: (b: B) => Option.Option<D>;
    }): Versioned<never, never, C, E, R, Option.Option<D>, E0 | E2, R0 | R2>;
};

Why

Drops absent pushed values while preserving an Option for the current read, making the two absence semantics explicit.

Ownership and lifetime

filterMap does not take ownership of its inputs. Its observation and current-read channels retain upstream lifetime, typed failures, services, and interruption behavior.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source