[L3] assertNever discards the offending value #29

Closed
opened 2026-06-27 03:54:48 +00:00 by sessamekesh · 0 comments
Owner

File: packages/viewer-react/src/IgviewerContext.tsx:49-51

function assertNever(v: never): never {
  throw new Error("Unreachable code reached!");
}

The thrown error doesn't include v, losing debugging info if the exhaustiveness guarantee is ever violated at runtime (e.g. a bad threading value crossing the boundary).

Fix: interpolate the value, e.g. throw new Error(`Unreachable: ${String(v)}`).


Filed by an automated AI code review (manual proof-of-concept run). Code locations reference the various-cleanup branch.

**File:** `packages/viewer-react/src/IgviewerContext.tsx:49-51` ```ts function assertNever(v: never): never { throw new Error("Unreachable code reached!"); } ``` The thrown error doesn't include `v`, losing debugging info if the exhaustiveness guarantee is ever violated at runtime (e.g. a bad threading value crossing the boundary). **Fix:** interpolate the value, e.g. `` throw new Error(`Unreachable: ${String(v)}`) ``. --- _Filed by an automated AI code review (manual proof-of-concept run). Code locations reference the `various-cleanup` branch._
Sign in to join this conversation.
No description provided.