Search⌘ K

Building Mapped Types and Utility Types

Learn how to define types that are based on other types using mapped and utility types.

TypeScript types

In addition to limiting variables to a set of specific literal values and defining enums, TypeScript allows us to define types that are based on other types, much like super-powered generics. These are called mapped types. TypeScript also has many predefined mapped types that it calls utility types.

So, let’s say we have our existing type TicketData:

interface TicketData {
 
...