MESSAGES
The diagnostic catalog: every code the runtime throws (as ShadowError) or warns with (through warn), mapped to its development text.
The diagnostic catalog: every code the runtime throws (as ShadowError) or warns with
(through warn), mapped to its development text. Read it to show or match a diagnostic by
code. formatMessage reads it only in development builds, so production bundles keep the
code (SHADOW_<CODE>) and drop the text (R-CODE-8) unless your own code imports this object.
Import#
ts
import { MESSAGES } from "@shadow-js/core/extend";
Signature#
ts
const MESSAGES: { readonly NO_OWNER_EFFECT: "An effect was created outside any owner, so it can never be disposed. Create it inside a component or createRoot()."; readonly NO_OWNER_CLEANUP: "onCleanup() was called outside any owner, so the cleanup will never run."; readonly NO_OWNER_ERROR: "onError() was called outside any owner, so the handler can never be reached."; readonly WRITE_IN_MEMO: "A signal was written inside a useMemo() computation. Derive values from sources instead, or write from an effect."; readonly CYCLE_DETECTED: "A reactive cycle was detected: a computation read itself while it was running."; readonly INFINITE_LOOP: "Effects kept re-triggering each other for more than 1000 passes; the flush was aborted."; readonly FLUSH_IN_EFFECT: "flushSync() was called while a flush was already running; the call was ignored."; readonly RUN_WITH_DISPOSED_OWNER: "runWithOwner() was called with an owner that is already disposed; the callback ran without an owner."; readonly DUPLICATE_CORE: "More than one copy of @shadow-js/core is loaded. Signals created by one copy are invisible to the other."; readonly CONTEXT_MISSING: "useContext() found no provider and the context has no default value."; readonly NO_OWNER_ID: "useId() was called outside any owner; the id is not stable across server and client."; readonly EACH_KEY_DUPLICATE: "Duplicate key in a keyed list; later duplicates get fresh rows each update."; readonly EFFECT_DEPS_IGNORED: "useEffect(fn, [deps]) ignores the array and re-runs on any signal it reads; use useEffect(deps, fn)."; }
Examples#
ts
import { MESSAGES, type MessageCode } from "@shadow-js/core/extend";
function explain(code: MessageCode): string {
return `${code}: ${MESSAGES[code]}`;
}