TypeScript Practice
Hands-on TypeScript lessons - add types to real JavaScript, run them instantly, and get checked by real tests.
TypeScript Practice
Twelve short, hands-on TypeScript lessons: start with basic type
annotations, build up through interfaces, function types, union types, and
generics, work through a capstone and a real runtime bug - then go deeper
with lessons 8-12: narrowing with in and instanceof, discriminated
unions, exhaustiveness checking with never, generic constraints, and a
generic Stack<T> class. Each lesson gives you a task and a Run button -
your code is checked against real tests the moment you run it. Everything
runs in your browser: your TypeScript is stripped down to plain JavaScript
on the fly, so what runs is exactly what your annotations describe.
Start with lesson 1. You can leave and come back any time - your code is saved locally.
Lessons
12 total- 01 Type annotations
- 02 Interfaces
- 03 Function types and default params
- 04 Union types and narrowing
- 05 Generics
- 06 Capstone: typed inventory lookup
- 07 Fix the bug: sorting numbers
- 08 Narrowing with in and instanceof
- 09 Discriminated unions
- 10 Exhaustiveness with never
- 11 Generic constraints
- 12 A generic class (capstone)