News for hackers. Stuff that matters.
Re:All I Want for Christmas Is These Seven TypeScript Improv... by TheCleric on Monday December 26, 2022 @07:07PM (#34143334)
> 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.

There are no comments on this comment yet.