type Person = { age: number; name: string; alive: boolean };
type Age = Person["age"];
// type Age = number
 
type I1 = Person["age" | "name"];
// type I1 = string | number
 
type I2 = Person[keyof Person];
// type I2 = string | number | boolean
 
type AliveOrName = "alive" | "name";
type I3 = Person[AliveOrName];
// type I3 = string | boolean

Unions

When accessed on unions, it will return all possible types of the property from all members:

export type Event =
  | {
      type: "click";
      event: MouseEvent;
    }
  | {
      type: "focus";
      event: FocusEvent;
    }
  | {
      type: "keydown";
      event: KeyboardEvent;
    };
 
type EventType = Event["type"];
// type EventType = "click" | "focus" | "keydown"