Re:Why doesn't TypeScript properly type Object.keys?
by eyelidlessness on Saturday June 24, 2023 @01:52PM
(#36460960)
Here’s a neat trick for those complex types:
type Identity<T> = T
// This can be made recursive to an extent, alas I’m on mobile
type Merge<T> = {
[K in keyof T]: Identity<T[K]>
}
type ReadableFoo = Merge<UnreadableFoo>
The downside is the underlying types tend to be more complex when viewed in your IDE, but I think it's worth it.