Skip to content

Create a read-only signal that auto-updates when dependencies change.

function computed<T>(fn: () => T): ReadonlySignal<T>
ParamTypeDescription
fn() => TComputation function — reads other signals

ReadonlySignal<T> — same as Signal but read-only (no .set(), .update(), or .value =).

import { signal, computed } from "@whisq/core";
const count = signal(3);
const double = computed(() => count.value * 2);
double.value; // 6
count.value = 5;
double.value; // 10 — auto-updated
  • signal() — the mutable primitive computed() reads from.
  • effect() — side effects triggered by signal/computed changes.
  • batch() — group writes so dependent computeds re-read only once.
  • partition() — convenience helper that returns two computeds splitting an array signal by a predicate.

Docs current to v0.1.0-alpha.9 . All releases →