4 ms·
> Deducing types from Object.entries would be pretty awesome. That would feel like black magic. Not really. Typescript already has the keyof keyword. For s
by TheCleric 4y ago
> Deducing types from Object.entries would be pretty awesome. That would feel like black magic.
Not really. Typescript already has the
keyof
keyword. For some reason though
Object.entries(T)
returns
string[]
when it could easily return
keyof typeof T
I've had to write a helper function that essentially does this for you with a generic and a cast, but it feels unnecessary.