Welcome to the TypeScript Exercises! This collection is designed to help you master TypeScript through hands-on practice, covering everything from basic typing to advanced type manipulation.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/typescript-exercises/typescript-exercises/llms.txt
Use this file to discover all available pages before exploring further.
What You’ll Learn
These exercises progressively build your TypeScript knowledge through real-world scenarios involving a user management system. Each exercise introduces new concepts while building on previous ones.Topics Covered
Basic Typing
Learn to define interfaces and type basic data structures
Refining Types
Master type narrowing and the
in operatorUnion Types
Work with type predicates and discriminated unions
Merged Types
Combine types with Partial and Omit utility types
Generics
Create reusable, type-safe functions and APIs
Type Declarations
Write declaration files for JavaScript libraries
Module Augmentation
Extend existing module type declarations
Advanced Type Mapping
Master complex type transformations and manipulations
Rules and Principles
Difficulty increases progressively with each exercise. Take your time to understand each concept before moving forward.
Exercise Structure
Each exercise follows this pattern:Getting Started
The exercises are based on a community platform scenario where you manage Users and Admins. As the project evolves, so do the TypeScript challenges:- Exercises 1-2: Basic typing foundations
- Exercises 3-5: Type refinement and utility types
- Exercises 6-10: Generics and advanced patterns
- Exercises 11-13: Working with external libraries
- Exercises 14-15: Advanced type mapping techniques
Source Repository
All exercises are available in the source repository at/src/exercises/. Each exercise contains:
index.ts- The problem to solveindex.solution.ts- The solutiontest.ts- Type assertions to verify correctness