JesusTheHun
Aarktype
•Created by JesusTheHun on 10/29/2024 in #questions
Union of generics
I've tried to write the following :
But unfortunately it doesn't work because the 2nd parameter accepts a maximum of 3 elements. Is there a way to add arbitrary number of element to a union issued from a generic ?
23 replies
Aarktype
•Created by JesusTheHun on 10/29/2024 in #questions
Merging types instead of using an intersection when using generics
I have a generic type like this one :
If the first argument already contains the property
metadata
, I would like this property to be dropped and replaced by the one from my generic type, instead of having an intersection, like in my example. Is it possible to do something like that ?7 replies
Aarktype
•Created by JesusTheHun on 10/28/2024 in #questions
Generic & intersection
I'm looking to have a helper
arkWithMetadata
, which basically takes a base type and add { metadata: { id: <id> }}
I wanted to write this :
But it doesn't work.
I want to retain both types doc
and id
.
Is there a way to do that ?
I also tried to write a function :
But it doesn't work either 🤷♂️
PS: I'm using v2.0.0-rc.18
21 replies