2 ms·
You can use a merge type (on mobile so this may be wrong, but hopefully gets you on your way to where you’re going): type Merge<T> = { [K in keyof T]: T[K]
by eyelidlessness 5y ago
You can use a merge type (on mobile so this may be wrong, but hopefully gets you on your way to where you’re going):
type Merge<T> = { [K in keyof T]: T[K] }
Typical usage is with intersection types like:
Merge<A & B>
Where the resulting type is not aliased, at least at the top level, and you just see the structure of both A and B. But it should also work for inheritance, interface extensions, and object type overloads.
I think as of either 4.4 or 4.5 you can also safely make it recursive.