When working with TypeScript, it's easy to create a type-safe array of object keys like so:
export type Keys<T> = [keyof T][];
export const keys = <T>(o: T): Keys<T> => Object.keys(o) as any;
const k = keys(a);
However, the challenge arises when trying to create a similar type for the values:
export type Values<T> = [T][keyof T];
// Using 'keyof T' to index type '[T]' throws an error.