Merging types instead of using an intersection when using generics

I have a generic type like this one :

generic('T', 'M')([ 'T', '&', { metadata: { id: 'M' }} ])


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 ?
Was this page helpful?