Implementing a left | right join of two objects based on their types is what I aim to achieve. For instance, there is an object config with the default type RequestInit.
config = {
headers: {
'Content-Type': 'application/json',
},
}
Additionally, I have a customized customConfig with a different type, like CustomRequestInit, which includes extra query parameters that will be combined with the URL later on.
customConfig = {
mode: 'cors',
headers: {
'Content-Type': 'application/json',
},
params: {
'tk': '2edr3q2afa3',
}
}
The properties of this object belong to the RequestInit class and should replace any corresponding properties in the config object. Any other properties from customConfig should not appear in the final config object. How can I perform a left join on these two objects based on their types, while excluding any additional keys brought in by CustomRequestInit?