TypeScript Course

TypeScript is JavaScript with a type system on top. Every valid JavaScript file is already valid TypeScript, but TypeScript lets you describe the shape of your data and catches a whole class of mistakes before your code ever runs, right in your editor. This course takes you from your first .ts file to generics, type-level programming and real-world Node.js and React projects.

What you'll learn

The course has 45 lessons in six parts:

  • Getting Started — what TypeScript is, installing it, basic types, inference, and the special types any, unknown, never and void.
  • Shaping Data — arrays, tuples, object types, interfaces, enums, literal types, unions, handling null, and type assertions.
  • Functions & Classes — typed functions, overloads, classes, inheritance, abstract classes, getters, setters and static members.
  • Generics & Type-Level Code — generics, narrowing, type guards, keyof, utility types, mapped types, conditional types and template literal types.
  • Organizing Code — modules, namespaces, declaration files, declaration merging and decorators.
  • TypeScript in Practice — async code, error handling, tsconfig.json, Node.js, React, tooling, migrating JavaScript projects, recent versions and best practices.

Every lesson shows real TypeScript code next to what actually happens: the program's output, or the exact error the compiler reports when the lesson is about catching a mistake. Every example has been checked against the real compiler. Most lessons also have a Try it yourself editor where you can edit and run the code in your browser.

This course assumes you already know basic JavaScript. If you don't, start with the JavaScript course.

Practice

  • Playground — a blank editor for your own experiments.
  • Exercises — fill-in-the-blank tasks and small coding problems with solutions.
  • Quiz — check your understanding across the whole course.
  • Syllabus & Study Plan — learning outcomes and a week-by-week schedule.

Lessons

Getting Started

  1. Introduction
  2. Setting Up TypeScript
  3. Basic Types
  4. Annotations & Inference
  5. any, unknown, never & void

Shaping Data

  1. Arrays
  2. Tuples
  3. Object Types & Type Aliases
  4. Interfaces
  5. Enums
  6. Literal Types
  7. Union & Intersection Types
  8. null, undefined & Optional Chaining
  9. Type Assertions

Functions & Classes

  1. Functions
  2. Function Overloads
  3. Classes
  4. Inheritance & Abstract Classes
  5. Getters, Setters & Static Members

Generics & Type-Level Code

  1. Generics
  2. Generic Constraints & Defaults
  3. Type Narrowing
  4. Custom Type Guards & Discriminated Unions
  5. keyof, typeof & Indexed Access
  6. Index Signatures & Record
  7. Utility Types
  8. More Utility Types
  9. Mapped Types
  10. Conditional Types & infer
  11. Template Literal Types

Organizing Code

  1. Modules
  2. Namespaces
  3. Declaration Files & @types Packages
  4. Declaration Merging
  5. Decorators

TypeScript in Practice

  1. Async Code & Promises
  2. Error Handling
  3. Compiling with tsconfig
  4. TypeScript with Node.js
  5. TypeScript with React
  6. Linting, Formatting & Testing
  7. Type-Checking JavaScript with JSDoc
  8. Migrating a JavaScript Project
  9. Recent TypeScript Versions
  10. Best Practices

Practice

  1. TypeScript Playground
  2. TypeScript Exercises
  3. TypeScript Quiz
  4. Syllabus & Study Plan
Where to start: begin with Introduction and work through in order. The Generics & Type-Level Code part builds directly on interfaces, unions and functions, so skipping ahead usually means coming back. If you already use TypeScript day to day, jump to whichever part you need — each lesson links back to the ones it depends on.