LLearnCode

Error library · 20 investigation cases

Turn an error message
into a testable explanation.

Search the symptom, inspect the boundary that failed, and repair the cause. Each case includes a controlled fixture, progressive investigation, a diagnosis challenge, and a worked review you open deliberately.

20 of 20 cases match.

TypeScript · synthetic incident

TS2322: string is not assignable to number

What was observed

A quantity form reads input.value into raw. Assigning raw to a number produces TS2322. The actual entered value is the string "12"; an empty field must be rejected, not converted into zero.

This is a controlled teaching fixture. Real errors with a similar message may have different causes.

Make a testable claim

These are your scratch notes, not an automatically graded answer. Notes remain while this workspace is open and are not saved across reloads.

Investigate one step at a time

Observe → reproduce → reduce → hypothesize → test → fix → regression test.

Choose the next investigation before opening its guidance. Compare the result with your hypothesis and revise the claim when the evidence disagrees.

0 of 4 investigation steps open.

Test the diagnosis · code completion

Complete the numeric guard after the blank-input guard. Accept only finite positive integers.

const raw = input.value;
if (raw.trim() === "") throw new Error("Required");
const quantity = Number(raw);
if (!(___)) throw new Error("Invalid quantity");

Checks the accepted fragment in this specific example. It does not compile or prove an arbitrary program.

Review the engineering decision

The worked diagnosis is available when you choose to review it. Before opening it, state what a regression test must prove.