Type alias Keys<T>

Keys<T>: keyof T

Represents the keys of a given type T. This type alias Keys<T> is equivalent to keyof T, which retrieves the union type of keys (property names) of type T.

Type Parameters

  • T

Returns

Union type of keys (property names) of type T.

Example

type Person = {
name: string;
age: number;
email: string;
};

type PersonKeys = Keys<Person>; => "name" | "age" | "email"