TypeScript exercises with solutions
45 practice problems from the 15 lessons of the TypeScript: JavaScript with Types course, in lesson order and from easy to hard inside each lesson. Open a problem, write your code and press Submit: the tests run in your browser and nothing is sent to a server.
15 easy problems 15 medium problems 15 hard problems
Why TypeScript
3 problems · Read the lesson
Basic types: primitives, arrays, tuples and unknown
3 problems · Read the lesson
Typed functions
3 problems · Read the lesson
Object types and interfaces
3 problems · Read the lesson
Type aliases, unions and intersections
3 problems · Read the lesson
Narrowing: from a union to one type
3 problems · Read the lesson
Classes in TypeScript
3 problems · Read the lesson
Inheritance, abstract classes and implements
3 problems · Read the lesson
Enums, as const and literal types
3 problems · Read the lesson
Generic functions
3 problems · Read the lesson
Generic classes and typed collections
3 problems · Read the lesson
Utility types
3 problems · Read the lesson
Mapped, conditional and template literal types
3 problems · Read the lesson
Async code with types
3 problems · Read the lesson
Designing type-safe programs
3 problems · Read the lesson