Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Mapped Types & `keyof` | TypeScript Mastery lesson | BraveProgrammer
  1. Courses
  2. /
  3. TypeScript Mastery

Lesson 11 of 56

·Typescript

Mapped Types & `keyof`

20 minutes

Course progress20%

keyof Operator

type Person = { name: string; age: number; };
type PersonKeys = keyof Person; // "name" | "age"

Mapped Types – Transform each property

type ReadonlyPerson = { readonly [K in keyof Person]: Person[K] };
// equivalent to: { readonly name: string; readonly age: number; }

Partial & Required

type PartialPerson = Partial<Person>; // all props optional
type RequiredPerson = Required<PartialPerson>; // back to required

Record Utility

type RoleMap = Record<string, "admin" | "user" | "guest">;
const roles: RoleMap = { alice: "admin", bob: "user" };

Info

Mapped types let you programmatically transform object shapes.
Make it stickPractice what you've learned1 quiz · 3 practical tests · Optional activities from TypeScript MasteryBrowse activities
Previous lessonGeneric ConstraintsContinue to lesson 12Conditional TypesBack to TypeScript Mastery curriculum