Skip to content
DevTrail

Learn TypeScript from Basic to Advanced

Add types to JavaScript and catch bugs before they run.

modules
10
topics
50
exercises
168
of practice
29 h 25 min

About this course

Learn TypeScript step by step: types, functions, objects, unions and narrowing, generics, advanced types, classes, modules and tsconfig, and TypeScript with React. Code runs in your browser.

What you'll learn

10 modules and 50 topics. Every topic has short lessons, a quiz, hands-on exercises checked in your browser, and interview questions.

  1. 1Getting Started

    What TypeScript is, why types help, compiling, and your first typed program.

    • What is TypeScript?
    • How TypeScript compiles to JavaScript
    • Your first typed program
    • Type inference
    • Module 1 assessment
  2. 2Basic Types

    Primitives, arrays, tuples, any vs unknown, never, literal types and type inference.

    • Primitives, arrays and tuples
    • any, unknown, void and never
    • null, undefined and strictNullChecks
    • Literal types and as const
    • Module 2 assessment
  3. 3Functions

    Typing parameters and returns, optional/default params, overloads and function types.

    • Parameter and return types
    • Optional, default and rest parameters
    • Function types and callbacks
    • Overloads and typing this
    • Module 3 assessment
  4. 4Objects and Interfaces

    Object types, interfaces vs type aliases, optional and readonly properties, index signatures.

    • Object types, optional and readonly
    • Interfaces vs type aliases
    • Index signatures and Record
    • Structural typing and excess property checks
    • Module 4 assessment
  5. 5Unions and Narrowing

    Union and intersection types, type guards, discriminated unions and exhaustiveness.

    • Union and intersection types
    • Narrowing: typeof, truthiness, equality, instanceof and in
    • Custom type guards (x is T)
    • Discriminated unions and exhaustive checks
    • Module 5 assessment
  6. 6Generics

    Generic functions, interfaces and classes, constraints and defaults.

    • Generic Functions
    • Generic Interfaces, Types and Classes
    • Constraints, keyof and Defaults
    • Common Generic Patterns
    • Module 6 assessment
  7. 7Advanced Types

    Utility types, keyof/typeof, indexed access, mapped, conditional and template literal types.

    • Utility Types
    • keyof, typeof and Indexed Access
    • Mapped Types
    • Conditional Types and infer
    • Template Literal Types, satisfies and as const
    • Module 7 assessment
  8. 8Classes and OOP

    Classes, access modifiers, abstract classes, implements and parameter properties.

    • Typed Classes, readonly and Parameter Properties
    • Access Modifiers, Getters/Setters and static
    • Inheritance, Abstract Classes and implements
    • Module 8 assessment
  9. 9Modules and tsconfig

    ES modules, declaration files, strict mode and the important tsconfig options.

    • ES Modules and import type
    • Declaration Files (.d.ts) and DefinitelyTyped
    • tsconfig.json and the strict Flags
    • Migrating a JavaScript Project Gradually
    • Module 9 assessment
  10. 10TypeScript with React

    Typing props, state, events, hooks, context and generic components.

    • Typing Props and children
    • Typing useState, useReducer and useRef
    • Typing Events and Context
    • Custom Hooks and Generic Components
    • Module 10 assessment