Turn JavaScript knowledge into safer code. Repair real type errors, explore what the compiler knows, and build a contract for data you can actually trust.
Real compiler24 lessons8 repair missionsExport your work
app.tsCHECK → UNDERSTAND → REPAIR
// A small contract. A useful catch.
let quantity: number = "three";
// Make the data match the intent.
let quantity: number = 3;
Confidence comes from understanding what the check can—and cannot—prove.
0 / 24 lesson checks0 / 8 type contracts repaired
REAL TYPESCRIPT. VISIBLE FEEDBACK.
Think, edit, check.
Edit the source and ask the compiler what it finds. This single-file workspace checks types and emits JavaScript; it never executes your code. Third-party imports and JSX are outside this lab’s scope.
Use the keyboard normally; Tab moves to the next control. Your draft is saved in this browser.
Bundled TypeScript 5.9.3. The first check loads the compiler and standard type libraries from this site. A background worker keeps checking off the page’s main thread; a time limit stops unusually expensive checks.
Compiler findings
Run a check to see diagnostics.
Types the compiler sees
Shows top-level variables and functions, not every intermediate expression.
Emitted JavaScript
Check a valid example to see the output.
Output is withheld when the compiler reports errors. Passing type checks does not prove runtime behavior is correct.
MAKE A USEFUL REPAIR
Eight small problems. Better instincts.
Load a mission into the workshop, edit the code and check the type contract. Missions use strict and indexed-access checking. Passing verifies these type relationships; it does not execute the function or prove its behavior.
See the type contract checked by the compilerReveal one possible repair
Read it, explain it, then try writing the repair yourself.
FEWER POSSIBILITIES. MORE USEFUL OPERATIONS.
Watch a branch narrow the choices.
This visual model starts with string | number | null | User | string[]. Choose a guard, then test a concrete sample. It illustrates branch logic; use the compiler workshop for actual inferred types.
True branch can still contain…
False branch can still contain…
TYPES DESCRIBE. VALIDATORS CHECK.
Give incoming data a real boundary.
Configure a User contract, edit a JSON response and validate it. Nothing is sent to an API. This builder checks flat fields, primitive values, finite numbers and arrays of strings; it does not validate email format or nested objects.
Choose fields
Your generated TypeScript
The validator returns errors; it does not silently coerce values or automatically narrow a caller’s variable. Extra fields are allowed unless you choose to reject them.