TypeScript Fundamentals

Learn TypeScript types, generics and strict mode to catch bugs before runtime. A hands-on course for JavaScript developers.

Start course →

What you'll learn

  • Configure a project with `tsconfig.json` and strict mode.
  • Annotate variables, functions, objects and classes with the right types.
  • Model data with unions, literals, enums and discriminated unions.
  • Write reusable code with generics and utility types.
  • Narrow types safely and type asynchronous code.

Syllabus

Module 1: Getting Started

  1. Why TypeScript?
  2. Setup & tsconfig.json

Module 2: Basic Types

  1. Primitive Types
  2. Arrays & Tuples
  3. any & unknown
  4. Type Inference

Module 3: Functions

  1. Typed Function Parameters
  2. Function Types
  3. Async Functions & Promise Types

Module 4: Objects & Interfaces

  1. Object Types & Interfaces
  2. Type Aliases vs Interfaces
  3. Optional & Readonly Properties

Module 5: Union & Intersection Types

  1. Union & Intersection Types
  2. Literal Types

Module 6: Enums

  1. Numeric Enums
  2. String Enums

Module 7: Classes

  1. Classes in TypeScript
  2. Access Modifiers & readonly

Module 8: Generics

  1. Generic Functions
  2. Generic Interfaces, Classes & Constraints

Module 9: Type Narrowing

  1. Type Guards
  2. Discriminated Unions

Module 10: Utility Types

  1. Utility Types at a Glance
  2. keyof, typeof & Type Assertions

Module 11: Modules

  1. Modules: import & export

Module 12: Advanced Basics

  1. Decorators at a Glance
  2. Declaration Files (.d.ts)
  3. Strict Mode & Compiler Errors