Hello, is there any possible way using this library to merge two objects, but instead of overriding equal props like MergeDeep
does, just exclude them.
Some examples:
type A = { one: 1; two: '2' }
type B = { one: 1; two: 2; three: boolean }
type Result = MergeCompatibleDeep<A, B>
// Result should be { one: 1, three: boolean }
// Types of property 'two' are incompatible.
type A = { one: 1; two: { nestedOne: 'nestedOne'; nestedTwo: 'nestedTwo' } }
type B = { one: 1; two: { nestedOne: 'nestedOne'; nestedTwo: 'nestedTwoDifferent' }; three: boolean }
type Result = MergeCompatibleDeep<A, B>
// Result should be { one: 1, two: { nestedOne: 'nestedOne' }, three: boolean }
// Types of property 'two.nestedTwo' are incompatible.
type A = { one: 1; two: 2; three: boolean }
type B = { one: 1; two: 2; three: boolean }
type Result = MergeCompatibleDeep<A, B>
// Result should be { one: 1; two: 2; three: boolean }
// Types are deeply compatible, so all the props land in the result
Motivation:
When you use some high order functions/components you should be careful what do you initially pass in arguments. Usually, such high order function do what they need with argument and pass all the arguments down the stream as is. Therefore there can be a situation where some of the functions get the argument that is correct by prop name, but not by the type. It is better to exclude such props at all from the initial arguments.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too