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
Basic Typing (Exercises 1-2)
Basic Typing (Exercises 1-2)
Master interface definitions, type annotations, and fundamental TypeScript concepts. Learn to define user types and understand basic type checking.
Type Guards & Union Types (Exercises 3-4)
Type Guards & Union Types (Exercises 3-4)
Understand discriminated unions, type predicates, and how to work with multiple types safely. Master type narrowing techniques.
Utility Types & Generics (Exercises 5-9)
Utility Types & Generics (Exercises 5-9)
Learn Partial, Omit, Pick, and other utility types. Dive deep into generic functions, constraints, and advanced generic patterns.
Advanced Generics (Exercise 10)
Advanced Generics (Exercise 10)
Master complex generic transformations like promisifying callback-based APIs with full type safety.
Type Declarations (Exercises 11-12)
Type Declarations (Exercises 11-12)
Write ambient type declarations for external modules and understand .d.ts files.
Module Augmentation (Exercise 13)
Module Augmentation (Exercise 13)
Extend existing module types and augment third-party library definitions safely.
Advanced Type Mapping (Exercises 14-15)
Advanced Type Mapping (Exercises 14-15)
Master mapped types, conditional types, and complex type transformations with practical class-based examples.
Quick Start
Visit the Platform
Navigate to typescript-exercises.github.io to access the interactive learning environment
Progress Through Exercises
Complete each exercise by fixing type errors. Solutions are available if you get stuck
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