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

MergeDeep: fixed optional when value type is any or never #777

Merged
merged 2 commits into from Dec 2, 2023

Conversation

Emiyaaaaa
Copy link
Collaborator

I think @skarab42 uses EnforceOptional to restore the '?' by check undefined, because he dosen't used keyof in the implementation.

Now I used keyof to resolve the issue #775 , thus EnforceOptional is useless, so I seem need remove it, but it will cause some case changed like:

MergeDeep<{a: string | undefined}, {}>
// Before: => {a?: string | undefined}
// After:  => {a: string | undefined}

But I still think I should remove EnforceOptional, what do you think? @sindresorhus

@sindresorhus
Copy link
Owner

thus EnforceOptional is useless, so I seem need remove it, but it will cause some case changed like:

That is a bug fix. The new behavior is the correct one.

But I still think I should remove EnforceOptional, what do you think?

👍

@Emiyaaaaa
Copy link
Collaborator Author

thus EnforceOptional is useless, so I seem need remove it, but it will cause some case changed like:

That is a bug fix. The new behavior is the correct one.

But I still think I should remove EnforceOptional, what do you think?

👍

got it, it's ready for review

@sindresorhus sindresorhus merged commit 609c097 into sindresorhus:main Dec 2, 2023
6 checks passed
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.

MergeDeep removes optionals from any and never fields
2 participants