Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 469 Bytes

File metadata and controls

43 lines (31 loc) · 469 Bytes

typelab / utils / KeyOf

type KeyOf<T> = T extends T ? keyof T : never;

Extracts the keys of an object type.

Type Parameters

Type Parameter Description

T

The object type.

Returns

The keys of the object.

Example

// Keys is 'a' | 'b'
type Keys = KeyOf<{ a: string; b: number }>;