Grokking TypeScript
Ask Author
Back to course home

0% completed

Vote For New Content

Mapped Types
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Mapped types in TypeScript allow you to create new types by transforming existing ones. They are particularly useful when you need to modify or refine properties in a type without manually defining a new structure.

At a basic level, mapped types iterate over each property of an existing type and apply changes, such as making properties optional, readonly, or changing their types. This is similar to how we map over arrays in JavaScript, but in this case, we are mapping over the keys of an object type.

Syntax

The general syntax of a mapped type looks like this:

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible