Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

oconnorjoseph
Copy link

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
Copy link
Author

@mattphillips senpai notice me

@builtbyjavi
Copy link

@mattphillips +1 senpai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants