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
Member of
Versioned

Import

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

Access Versioned.filterMap through the imported Versioned export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

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