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,neverandvoid. - 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
Shaping Data
- Arrays
- Tuples
- Object Types & Type Aliases
- Interfaces
- Enums
- Literal Types
- Union & Intersection Types
- null, undefined & Optional Chaining
- Type Assertions
Functions & Classes
- Functions
- Function Overloads
- Classes
- Inheritance & Abstract Classes
- Getters, Setters & Static Members
Generics & Type-Level Code
- Generics
- Generic Constraints & Defaults
- Type Narrowing
- Custom Type Guards & Discriminated Unions
- keyof, typeof & Indexed Access
- Index Signatures & Record
- Utility Types
- More Utility Types
- Mapped Types
- Conditional Types & infer
- Template Literal Types
Organizing Code
TypeScript in Practice
- Async Code & Promises
- Error Handling
- Compiling with tsconfig
- TypeScript with Node.js
- TypeScript with React
- Linting, Formatting & Testing
- Type-Checking JavaScript with JSDoc
- Migrating a JavaScript Project
- Recent TypeScript Versions
- Best Practices