I created a type in TypeScript:
type SomeType = Array<{...}>;
It defines an array of objects with many different properties in place of the ...
.
I'd like to create another type that should have the exact same structure as SomeType
, just without the array ..so basically I need only that object definition from it like:
type SomeOtherType = {...};
Is there some way to create SomeOtherType
based on SomeType
so I don't have to list all properties of that object again creating redundancy in the code?
I don't want to use interfaces this time, I'd like to know how this would be possible with types.
I read this but couldn't figure it out based on the docs. Maybe mapped types is what I need?