TypeScript Mastery

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.

See pricing

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.

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.

  1. Unit 1:Type Trailhead

    Why TypeScript, primitives, inference, any and unknown, arrays, tuples and functions.

    Free
    1. 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
    2. Primitive Types and Annotations string, number, boolean, bigint, null and undefined, and the colon that annotates a variable.
      2 problems
    3. 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
    4. 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
    5. Arrays and Tuples Lists of one type, read-only arrays, and tuples: fixed-length arrays where each position has its own type.
      2 problems
    6. Typing Functions Parameter and return types, optional and default parameters, rest parameters, void, and function types.
      1 problem
  2. Unit 2:Object Outpost

    Object types, interfaces, index signatures, structural typing and excess property checks.

    Free
    1. 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
    2. Interfaces Declare object shapes with interface, extend them, and know when to pick interface or type.
      1 problem
    3. Index Signatures and Record Objects used as dictionaries: index signatures, Record, and why Map is often the better choice.
      2 problems
    4. Structural Typing TypeScript compares shapes, not names: what makes one type assignable to another.
      2 problems
    5. Excess Properties and Intersections Why a fresh object literal with an extra property is an error, and combining shapes with &.
      2 problems
  3. Unit 3:Union Junction

    Unions and literal types, narrowing, discriminated unions, exhaustiveness and type guards.

    Pro
    1. Union and Literal Types A value that may be one of several types, exact values as types, and the as const assertion.
      2 problems
    2. Narrowing typeof, truthiness, equality, in and instanceof: how checks you already write make TypeScript smarter.
      1 problem
    3. Discriminated Unions A shared literal tag on every member: the most useful pattern in TypeScript for modeling states and messages.
      2 problems
    4. Exhaustiveness with never Make the compiler tell you about every switch that forgot the new case you just added.
      1 problem
    5. 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
  4. Unit 4:Generic Gorge

    Generic functions, constraints, keyof and indexed access, generic types and everyday patterns.

    Pro
    1. Generic Functions Type parameters: functions that work for any type and still remember which one they got.
      1 problem
    2. Constraints and Defaults T extends Something: require what the function needs from T, and give type parameters defaults.
      1 problem
    3. 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
    4. Generic Interfaces, Types and Classes Containers and wrappers that take a type parameter: Box<T>, Page<T>, a typed Stack<T> class.
      1 problem
    5. Generics in Practice groupBy, a typed cache, and functions that take and return functions: generics in everyday code.
      2 problems
  5. Unit 5:Type Summit

    Utility types, mapped types, conditional types, infer and template literal types.

    Pro
    1. Utility Types Partial, Required, Readonly, Pick, Omit, Record, ReturnType, Parameters, Awaited and NonNullable.
      2 problems
    2. 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
    3. Conditional Types T extends U ? X : Y: types that choose, distribute over unions, and filter them.
      1 problem
    4. infer Pull types out of other types inside a conditional: the trick behind ReturnType, Parameters and Awaited.
      1 problem
    5. Template Literal Types String types built like template strings: event names, CSS units, route params, and string casing helpers.
      2 problems
  6. Unit 6:Class Canyon

    Classes and access modifiers, abstract classes, enums, satisfies and declaration files.

    Pro
    1. Classes and Access Modifiers Typed fields, public, private and protected, readonly, parameter properties, and # private fields.
      1 problem
    2. 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
    3. 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
    4. satisfies, as const and Assertions Check a value against a type without widening it, freeze literals, and when (not) to use as.
      2 problems
    5. Declaration Files and tsconfig declare, .d.ts files and @types packages, modules as types, and the tsconfig options that make TypeScript strict.
      1 problem
  7. Unit 7:Production Peak

    Async data and validation, Result types, DOM events, a typed store and the boss emitter.

    Pro
    1. Typing Async Code and API Responses Promise<T>, async functions, and turning unknown JSON from a server into data you can trust.
      2 problems
    2. Errors as Values catch gives you unknown, throw is invisible in types, and a Result union makes failure part of the signature.
      2 problems
    3. Typing DOM Events querySelector generics, element types, event types, and handlers that know what they are handling.
      2 problems
    4. A Typed State Store State, actions as a discriminated union, a reducer, and a generic store with typed subscriptions.
      2 problems
    5. 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

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.

All courses