TypeScript 7 · Types
Get the keys of a type
Build a union of an object type's keys.
type UserKey = keyof User; // "id" | "name" | "email"
Official TypeScript 7 documentation
TypeScript 7 · Types
Build a union of an object type's keys.
type UserKey = keyof User; // "id" | "name" | "email"
Official TypeScript 7 documentation
Was this page helpful?