- Preserves the keys type of a typed object instead of getting a union of the actual keys values (see playground)
/**
* A strongly-typed version of `Object.keys()`
*
* Details:
* https://gist.github.com/alexilyaev/3fe3e6e6065b9f19450ac52a11209f52
*/
// I don't know how to solve this use case without a type assertion
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
export const objectKeysTyped = Object.keys as <Type extends object>(
value: Type
) => (keyof typeof value)[];