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

Improve DeepPartial using recursive types #8187

Merged
merged 4 commits into from Feb 16, 2022

Conversation

MatthiasKunnen
Copy link
Contributor

@MatthiasKunnen MatthiasKunnen commented Sep 15, 2021

Description of change

Fixes #2904.

This change improves the DeepPartial check and prevents TypeScript from errorring unnecessarily in cases described in the aforementioned issue. On the flipside, it now errors on .save() in case a string property is passed instead of a Date. As such this PR will be a breaking change. I created a second commit that highlights what resolving the breaking change would look like.

What are your thoughts?

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

Requires TypeScript >= 3.7.

BREAKING CHANGE: DeepPartial will now complain about passing a string property instead of a Date.
@imnotjames
Copy link
Contributor

There's still a few more type issues here. Are you going to be cleaning those up?

@MatthiasKunnen
Copy link
Contributor Author

Yes, but only if the maintainers are interested in the PR. If they are not interested, then there is not much point to fixing them. I'm waiting for feedback atm.

@Alwinator
Copy link

@imnotjames @MatthiasKunnen @pleerock Any news here? I would need this feature!

@pleerock
Copy link
Member

it's postponed since its a breaking change. No estimates for now.

@pleerock
Copy link
Member

I applied more simple change based on this SO answer. Your test seem to pass and change doesn't look breaking. I think we can merge it.

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.

Type DeepPartial issue when used with generics
4 participants