variable / @typed/fx/RefTuple

get

Projects one statically valid tuple index as Computed state.

Package version
2.0.0-beta.13
Category
Derived queries
Since
1.18.0

Import

import { get } from "@typed/fx/RefTuple";

Signatures

export declare const get: {
    <T extends ReadonlyArray<unknown>, I extends Indices<T> & keyof T>(index: I): <E, R>(ref: RefTuple<T, E, R>) => RefSubject.Computed<T[I], E, R>;
    <T extends ReadonlyArray<unknown>, I extends Indices<T> & keyof T, E, R>(ref: RefTuple<T, E, R>, index: I): RefSubject.Computed<T[I], E, R>;
};

Why

The index is constrained to the tuple’s known indices, so every current value has that element. The result is Computed, cannot become absent, and does not add NoSuchElementError.

Ownership and lifetime

The get view retains no independent state. An Effect read samples the source once; Fx observation follows later pushes and its observing Scope owns subscription cleanup.

Other public imports

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

Source