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
fix: Update DeepPartial for usage of generics with Repository class #8817
Conversation
It seems after the Using a signature like this seems to work: - save<T extends DeepPartial<Entity>>
+ save<T extends Entity | DeepPartial<Entity>> Since the above works, we can instead union the original T as part of the DeepPartial type. This seems to work even better as it has fewer changes to core code, and will be more flexible for future use cases. TS now seems to be able to decide on the right one since the non-deeppartial type is now explicitly available: - export type DeepPartial<T> = T extends Array<infer U>
+ export type DeepPartial<T> = T | (T extends Array<infer U>
? DeepPartial<U>[]
: T extends Map<infer K, infer V>
? Map<DeepPartial<K>, DeepPartial<V>>
: T extends Set<infer M>
? Set<DeepPartial<M>>
: T extends object
? { [K in keyof T]?: DeepPartial<T[K]> }
- : T
+ : T) I ran this new DeepPartial through all the tests and they seem to pass as well. Aside: Also added an await to the service |
Great. Updated DeepPartial with @pbrn46 recommendations. Tests pass! |
If merged it will close this issue too #8698 |
Failing cockroachdb test. Unsure why. Any ideas? |
@nelsonfleig cockroachdb is super dumb. I'm going to restart the tests. |
Also, beware the package-lock.json has been updated to lockfile v2 in the first commit. Not sure if that would affect the tests. :) |
True that could be. Shouldn't have commited that. Will restore it now. |
Unfortunately the same cockroachdb test still fails despite restoring the package-lock.json
I also see other PRs failing in the same test. |
Any updates on the failing cockroachdb test? |
test was failing due to issue on master branch. Let me merge this PR. |
Description of change
Update DeepPartial to work with a generic passed to Repository then testing on an abstract service.
This issue is related with Fixes #8681
Pull-Request Checklist
master
branchnpm run format
to apply prettier formattingnpm run test
passes with this changeFixes #8681