Skip to main content

TypeScript Exercises

Learn TypeScript through hands-on, progressive exercises. Start with basic typing and advance to complex type manipulations.

Why TypeScript Exercises?

TypeScript Exercises provides an interactive, browser-based environment to master TypeScript’s type system. With 16 carefully crafted exercises, you’ll progress from basic concepts to advanced type manipulation techniques.

Progressive Learning

Start simple and gradually build expertise through 16 structured exercises

Real-time Feedback

Get instant type checking and error feedback as you code

Hands-on Practice

Learn by doing with practical, real-world scenarios

Self-paced

Complete exercises at your own speed with solutions available

Comprehensive Coverage

Master interfaces, generics, utility types, and advanced patterns

Interactive Editor

Code directly in your browser with Monaco Editor

What You’ll Learn

Master interface definitions, type annotations, and fundamental TypeScript concepts. Learn to define user types and understand basic type checking.
Understand discriminated unions, type predicates, and how to work with multiple types safely. Master type narrowing techniques.
Learn Partial, Omit, Pick, and other utility types. Dive deep into generic functions, constraints, and advanced generic patterns.
Master complex generic transformations like promisifying callback-based APIs with full type safety.
Write ambient type declarations for external modules and understand .d.ts files.
Extend existing module types and augment third-party library definitions safely.
Master mapped types, conditional types, and complex type transformations with practical class-based examples.

Quick Start

1

Visit the Platform

Navigate to typescript-exercises.github.io to access the interactive learning environment
2

Start with Exercise 1

Begin with basic typing concepts and interface definitions
3

Progress Through Exercises

Complete each exercise by fixing type errors. Solutions are available if you get stuck
4

Master TypeScript

By exercise 16, you’ll have comprehensive knowledge of TypeScript’s type system

Exercise Topics

Basic Typing

Interface definitions and type annotations

Refining Types

Type predicates and type guards

Union Types

Working with discriminated unions

Merged Types

Type intersections and combinations

Generics

Utility types and generic constraints

Type Declarations

Writing ambient declarations

Module Augmentation

Extending module types

Advanced Mapping

Mapped and conditional types

Ready to Learn?

Start Learning TypeScript

Begin your TypeScript journey with our comprehensive exercise platform

Build docs developers (and LLMs) love