TypeScript Exercises
Exercises
Test your TypeScript skills with exercises from all categories:
Introduction
Get Started
Simple Types
Explicit Types and Inference
Special Types
Arrays
Tuples
Object Types
Enums
Aliases & Interfaces
Union Types
Functions
Casting
Classes
Basic Generics
Utility Types
Keyof
Null
Definitely Typed
TypeScript 5 Updates
Configuration
Node.js
React
Tooling
Advanced Types
Type Guards
Conditional Types
Mapped Types
Type Inference
Literal Types
Namespaces
Index Signatures
Declaration Merging
Async
Decorators
JSDoc
Migration
Error Handling
Best Practices
Log in to track your progress
If you haven't already, sign up to become a W3Schooler, and get points for every exercise you complete.
As a logged on W3Schools user you will have access to many features like having your own web page, track your learning progress, receive personal guided paths, and more.
The Exercise
The exercises are a mix of "multiple choice" and "fill in the blanks" questions. There are between 2 and 5 questions in each category. The answer can be found in the corresponding tutorial chapter. If you're stuck, or answer wrong, you can try again or hit the "Show Answer" button to see the correct answer.
If you don't know TypeScript, we suggest that you read our TypeScript Tutorial from scratch.