JavaScript lets you write almost anything, and finds out what you meant in front of a customer. TypeScript adds a layer of checking before the program runs: it knows what kind of value everything is, and it refuses the combinations that cannot work. The skill is not memorising syntax. It is describing your data so exactly that the compiler can catch your mistakes, and knowing precisely where the compiler stops and your own checks must begin.
This is the sixth season of Sabi Logistics’ story. Ngozi, Amara, Emeka and Chidi are moving the tracking API to TypeScript after a weight arrived as text and jammed a label printer. Each case hands you a piece of that code with your own names, fields and rules, and the real TypeScript compiler, in strict mode, checks your work in the browser: it must accept what is valid, refuse what is not, and your functions must behave exactly as specified, on examples you can see and on batches you cannot. The first run downloads the compiler (several megabytes, then your browser remembers it).
What you will learn
- Describe data exactly: interfaces, readonly, optional fields and literal unions.
- Choose one: discriminated unions, narrowing and exhaustive checks with never.
- One function, many types: generics that keep types linked, and why any is the enemy.
- Trust nothing: unknown, type guards and why types cannot protect you from outside data.
- The missing value: strict null checks, optional chaining and defaults, and the cost of the exclamation mark.
- The typed handler: an API as a function from Request to Response, with exact status codes.
- Never trust the body: validating every request and naming every wrong field.
- A typed client: a Result type, retries for the right failures and a fake fetcher for tests.
- The typed release: a state machine, filtering and paging, and the order of checks, tested with dozens of real requests.
A graded capstone and an exam finish the course. Two free guides show how to set up TypeScript, an editor and a test runner on your own computer.