All 35 Bugs /
0/35 Fixed ✓
TypeScriptMedium~12 min

Discriminated Union Exhaustiveness Bug

What's Broken (Symptom)

A new `{ status: "loading" }` union variant was added to `FetchState`, and `renderBadge(state)` silently returns `undefined` instead of handling it cleanly.

Expected Behavior

  • Handle all variants (`"idle"`, `"loading"`, `"success"`, `"error"`) with zero `undefined` returns.
  • Add a `never` exhaustiveness helper/check in `default:` so future union variants fail cleanly if unhandled.
  • Format `"success"` badge as `"Loaded (<count>)"` and `"error"` as `"Error: <message>"`.

Debugging Hints (0/2 used)

Try spotting the bug in the editor first. Need a nudge? Reveal Hint 1 anytime.

Root Cause Breakdown

Pass all 3 automated verification checks on the right to unlock the full Root Cause explanation.

Automated Bug Verification

3 Checks Ready
  • Handles loading state instead of returning undefinedrenderBadge({ status: "loading" }) returns a non-empty string.
  • Correctly renders idle, success, and error union variantsVerify exact badge formatting for every union member.
  • Includes default exhaustiveness handlingHandles unknown runtime input safely without returning undefined.
bugfix.ts
Live Sandboxed PreviewCtrl + Enter to verify
Console Output0 log(s)
No console output yet. Run Preview or Verify Bug Fix.