How to make a union type from an object index signature key type in Typescript?
Originally Published Here ๐!
To make a union type from an object index signature key, we can use the keyof operator followed by the index signature name in TypeScript.
TL;DR
// `Person` index signature
type Person = {
[key: string]: number;
};
//...
melvingeorge-me.hashnode.dev3 min read