variable / @typed/fx/RefHashMap

findFirst

Find the first entry satisfying a predicate.

Package version
2.0.0-beta.7
Category
Optional queries
Since
1.18.0

Import

import { findFirst } from "@typed/fx/RefHashMap";

Signatures

export declare const findFirst: {
    <K, V>(predicate: (value: V, key: K) => boolean): <E, R>(ref: RefHashMap<K, V, E, R>) => RefSubject.Filtered<[
        K,
        V
    ], E, R>;
    <K, V, E, R>(ref: RefHashMap<K, V, E, R>, predicate: (value: V, key: K) => boolean): RefSubject.Filtered<[
        K,
        V
    ], E, R>;
};

Why

Models the possibly absent result of find first as Filtered state, so absence stays explicit while later source versions can make a value available.

Ownership and lifetime

The find first view retains no independent value. Its Effect read fails with NoSuchElement while absent; the observing Scope owns and finalizes its Fx subscription.

Other public imports

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

Source