deep-object-diff icon indicating copy to clipboard operation
deep-object-diff copied to clipboard

Improved index.d.ts to utilize generics that reflect the recursive transformation of array field types into object types

Open oconnorjoseph opened this issue 1 year ago • 2 comments

This PR takes #98 a step further to force the type system to reflect the recursive transformation of array field types into the object structure presented in the README examples. Those examples show that we cannot simply use Partial<T> for the return type of each function. To recap,

diff({ bar: ['a', 'b'] }, { bar: ['a'] }));

Evaluates to:

{
  bar: {
    '1': undefined
  }
}

So the type returned by diff must reflect that as well. That is the purpose of this PR'sDiffRemovable<T> type.

oconnorjoseph avatar Feb 08 '24 07:02 oconnorjoseph

@mattphillips senpai notice me

oconnorjoseph avatar Feb 18 '24 19:02 oconnorjoseph

@mattphillips +1 senpai

builtbyjavi avatar Feb 18 '24 22:02 builtbyjavi