TypeScript Mastery
TypeScript Course with Real Type Checking
From your first annotation to generics, mapped types and type-safe APIs, checked by the real compiler.
36 lessons across 7 units: runnable examples, quizzes and 55 coding problems graded by the TypeScript type checker and by tests.
- Units
- 7
- Lessons
- 36
- Coding problems
- 55
- Examples
- 70
Free: units 1 to 2 (11 lessons). Units 3 to 7 with DevArcade Pro.
Want to try something first? Try our online typescript compiler, free and with no sign-up.
What you'll learn
- Type TrailheadWhy TypeScript, primitives, inference, any and unknown, arrays, tuples and functions.
- Object OutpostObject types, interfaces, index signatures, structural typing and excess property checks.
- Union JunctionUnions and literal types, narrowing, discriminated unions, exhaustiveness and type guards.
- Generic GorgeGeneric functions, constraints, keyof and indexed access, generic types and everyday patterns.
- Type SummitUtility types, mapped types, conditional types, infer and template literal types.
- Class CanyonClasses and access modifiers, abstract classes, enums, satisfies and declaration files.
- Production PeakAsync data and validation, Result types, DOM events, a typed store and the boss emitter.
Who it's for
JavaScript developers moving to TypeScript, React and Node developers who want to stop fighting the compiler, and anyone preparing for a codebase that uses strict mode.
Before you start
Comfortable JavaScript: functions, objects, arrays, classes and promises. JS Mastery covers what you need.
Practise it
- Online TypeScript compilerFree, no sign-up.
Course outline
7 units and 36 lessons. Each lesson has a short read with examples you run, a quiz, and coding problems tested in your browser; most have a step-through visualizer.
- Free
Unit 1:Type Trailhead
Why TypeScript, primitives, inference, any and unknown, arrays, tuples and functions.
- Why TypeScript? JavaScript with types: what the compiler checks, what happens to the types when the code runs, and how this course grades your code.1 problem
- Primitive Types and Annotations string, number, boolean, bigint, null and undefined, and the colon that annotates a variable.2 problems
- Type Inference How TypeScript works out types you never wrote, why const and let infer differently, and when an annotation is worth it.1 problem
- any, unknown and never The escape hatch that switches checking off, the safe type for values you have not inspected yet, and the type with no values.2 problems
- Arrays and Tuples Lists of one type, read-only arrays, and tuples: fixed-length arrays where each position has its own type.2 problems
- Typing Functions Parameter and return types, optional and default parameters, rest parameters, void, and function types.1 problem
-
- Free
Unit 2:Object Outpost
Object types, interfaces, index signatures, structural typing and excess property checks.
- Object Types and Type Aliases Describe the shape of an object, name it with a type alias, and mark properties optional or read-only.1 problem
- Interfaces Declare object shapes with interface, extend them, and know when to pick interface or type.1 problem
- Index Signatures and Record Objects used as dictionaries: index signatures, Record, and why Map is often the better choice.2 problems
- Structural Typing TypeScript compares shapes, not names: what makes one type assignable to another.2 problems
- Excess Properties and Intersections Why a fresh object literal with an extra property is an error, and combining shapes with &.2 problems
-
- Pro
Unit 3:Union Junction
Unions and literal types, narrowing, discriminated unions, exhaustiveness and type guards.
- Union and Literal Types A value that may be one of several types, exact values as types, and the as const assertion.2 problems
- Narrowing typeof, truthiness, equality, in and instanceof: how checks you already write make TypeScript smarter.1 problem
- Discriminated Unions A shared literal tag on every member: the most useful pattern in TypeScript for modeling states and messages.2 problems
- Exhaustiveness with never Make the compiler tell you about every switch that forgot the new case you just added.1 problem
- Type Predicates and Assertion Functions Write your own narrowing functions: x is T for checks that return a boolean, asserts x is T for checks that throw.2 problems
-
- Pro
Unit 4:Generic Gorge
Generic functions, constraints, keyof and indexed access, generic types and everyday patterns.
- Generic Functions Type parameters: functions that work for any type and still remember which one they got.1 problem
- Constraints and Defaults T extends Something: require what the function needs from T, and give type parameters defaults.1 problem
- keyof and Indexed Access The union of an object type’s keys, the type at a key, and K extends keyof T for safe property access.2 problems
- Generic Interfaces, Types and Classes Containers and wrappers that take a type parameter: Box<T>, Page<T>, a typed Stack<T> class.1 problem
- Generics in Practice groupBy, a typed cache, and functions that take and return functions: generics in everyday code.2 problems
-
- Pro
Unit 5:Type Summit
Utility types, mapped types, conditional types, infer and template literal types.
- Utility Types Partial, Required, Readonly, Pick, Omit, Record, ReturnType, Parameters, Awaited and NonNullable.2 problems
- Mapped Types Build a new object type by looping over the keys of another: how Partial and Readonly work, modifiers and key remapping.2 problems
- Conditional Types T extends U ? X : Y: types that choose, distribute over unions, and filter them.1 problem
- infer Pull types out of other types inside a conditional: the trick behind ReturnType, Parameters and Awaited.1 problem
- Template Literal Types String types built like template strings: event names, CSS units, route params, and string casing helpers.2 problems
-
- Pro
Unit 6:Class Canyon
Classes and access modifiers, abstract classes, enums, satisfies and declaration files.
- Classes and Access Modifiers Typed fields, public, private and protected, readonly, parameter properties, and # private fields.1 problem
- Abstract Classes and implements Contracts for classes: implements checks a class against an interface; abstract classes share code and leave holes to fill.1 problem
- Enums and Their Alternatives Numeric and string enums, what they compile to, and why many teams prefer literal unions and as const objects.1 problem
- satisfies, as const and Assertions Check a value against a type without widening it, freeze literals, and when (not) to use as.2 problems
- Declaration Files and tsconfig declare, .d.ts files and @types packages, modules as types, and the tsconfig options that make TypeScript strict.1 problem
-
- Pro
Unit 7:Production Peak
Async data and validation, Result types, DOM events, a typed store and the boss emitter.
- Typing Async Code and API Responses Promise<T>, async functions, and turning unknown JSON from a server into data you can trust.2 problems
- Errors as Values catch gives you unknown, throw is invisible in types, and a Result union makes failure part of the signature.2 problems
- Typing DOM Events querySelector generics, element types, event types, and handlers that know what they are handling.2 problems
- A Typed State Store State, actions as a discriminated union, a reducer, and a generic store with typed subscriptions.2 problems
- Boss: A Type-Safe Event Emitter Everything at once: generics, keyof, indexed access, mapped types and classes, in the API every framework has.1 problem
-
TypeScript Mastery: frequently asked questions
Are the TypeScript exercises really type-checked?
Yes. Each problem is graded by the TypeScript compiler in strict mode as well as by tests, so you see the same errors a real project would show.
Does it cover generics and utility types?
Yes: generics, constraints, keyof, conditional and mapped types, the built-in utility types, and type-safe API patterns all have their own lessons.
Do I need to install TypeScript?
No. You write and check TypeScript in your browser; there is no tsconfig or npm to set up.
Is it free?
Yes, to start. Sign up free and units 1 and 2 of this course are yours, lessons, quizzes and coding problems included, with no time limit. DevArcade Pro opens the remaining units of every course.
Start TypeScript Mastery for free
Enroll for free and units 1 and 2 are yours. DevArcade Pro opens every unit of every course, including new ones as they launch, monthly or yearly.