Mapped types in TypeScript are a way to create new types based on existing ones. They allow modifying the properties of objects or other types according to specific rules. Example of using mapped types:
type Person = { name: string, age: number, address: string }; type ReadOnlyPerson = { readonly [K in keyof Person]: Person[K] }; // ReadOnlyPerson will have all properties of 'Person', but they will be readonly.
Mapped types are useful when we need to generate different variations of a type based on a base type, such as creating different versions of objects or states.