TypeScript tutorialLesson 29Free preview
TS Mapped Types
This lesson is part of TypeScript · All levels
Summary
Mapped types build new types by iterating the properties of other types using the [K in Keys] pattern. You can add a readonly or optional modifier, even replace the key name with the as clause. This technique forms the basis of many of the built-in TypeScript utility types.
Key points
- Mapped type using [K in Keys]: T
- Modifier readonly and can be applied
- Clause as changes the name of the key
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.