Typescript: using keyof and lookup types

Example:

type Person = {
  name: string,
  age: number
};
type PersonKeys = keyof Person;
The keyof operator gets the keys of an object type as a string or numeric literal union.

Solution:

// Leverage keyof for dynamic property access and type safety.

Beginner's Guide to TypeScript