Skip to main content

objectKeys

A utility function which behaves identical to Object.keys(). It strictly infers the key type of an object.

Example

const languages = {
rust: 1,
swift: 2,
javascript: 3,
} as const;

Object.keys(languages); // Array<string>

objectKeys(languages); // Array<'rust' | 'swift' | 'javascript'>