Import
import { scan } from "@typed/fx/RefSubject";Signatures
export declare const scan: {
<S, A>(initial: S, f: (s: S, a: A) => S): <E, R>(ref: RefSubject<A, E, R> | Computed<A, E, R>) => Computed<S, E, R>;
<A, E, R, S>(ref: RefSubject<A, E, R> | Computed<A, E, R>, initial: S, f: (s: S, a: A) => S): Computed<S, E, R>;
<R0, E0, A, E, R, E2, R2, S>(versioned: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, initial: S, f: (s: S, a: A) => S): Computed<S, E0 | E | E2, R0 | R2 | Exclude<R, Scope.Scope>>;
};Why
Stateful scan over a RefSubject / Computed, producing a Computed of the accumulated state.
Fx subscriptions follow Fx.scan semantics (emit initial, then fold each source value).
Effect sampling accumulates across source versions via a private state ref (do not mix heavy
subscribe + sample on the same scan if you need a single shared accumulator). The result remains
a lazy view rather than a duplicated mutable value.
Ownership and lifetime
Each Effect Context object gets a private current-read accumulator, advanced after a successful
fold for a new source version. The pushed channel runs Fx.scanEffect from initial inside
Subject.hold: observers using the same Context share that active scan and retained result.
The last observer ends its session and clears its held value. The observing Scope owns
subscription cleanup. Read accumulators are weakly held by Context and need no finalizer.
Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.