How to transform type of object with TS so that the values are of same type but wrapped in Array
Can someone pls help with this issue I'm having.
I have a type like so:
I'm doing some processing with formidable which then turns an object of myType into this:
I want to extract that type. Which basically means, take the type myType or myZodType as it is and turn it into an object that has the same keys but the types of values are now wrapped in an array.
I've done this for now, but don't know how to continue...
I'm kind of confident about this last one, don't know about the any type though...
6 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
UPDATE!
Found out about the Record utility type which does what I need.
Which then turns my new object like so:
Into:
Just seen your reply, yes it works, TY!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Just realized it's not quite right...
Because it doesn't take each of the properties and puts that type in array. It makes the values be of any type of all the property types
e.g.
becomes
instead of
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Perfect, tyvm 😄