Skip to main content

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.

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.

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 operator

Union 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

Avoid using any type at all costs. The goal is to leverage TypeScript’s type system fully.
Difficulty increases progressively with each exercise. Take your time to understand each concept before moving forward.

Exercise Structure

Each exercise follows this pattern:
1

Read the Intro

Understand the scenario and context for the exercise
2

Review the Problem

Identify what needs to be fixed or implemented
3

Implement the Solution

Apply TypeScript features to solve the problem
4

Verify with Tests

Ensure your solution passes type checks

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
Each exercise includes links to relevant TypeScript documentation to help you if you get stuck.

Source Repository

All exercises are available in the source repository at /src/exercises/. Each exercise contains:
  • index.ts - The problem to solve
  • index.solution.ts - The solution
  • test.ts - Type assertions to verify correctness

Next Steps

Ready to begin? Start with Basic Typing to learn the fundamentals, or jump to any topic that interests you!