Readable type
Home > @rimitive/signals > Readable
Readable type
Section titled “Readable type”A readable reactive value (signal or computed).
Call with no arguments to read the current value. Reading inside a reactive context (effect, computed) creates a dependency.
Signature:
export type Readable<T> = { (): T;};Example
Section titled “Example”const count: Readable<number> = computed(() => items().length);
// Read the valueconsole.log(count()); // 5
// Reading inside effect creates dependencyeffect(() => { console.log(count()); // Tracks count as dependency});