deepkit-framework
deepkit-framework copied to clipboard
fix(orm): fix useJoin JoinDatabaseQuery generic for optional properties
Summary of changes
Whenever doing a useJoin
on some class property it uses T[K]
, but when T[K]
is optional/can be undefined this leads to a return type being JoinDatabaseQuery<SomeEntity | undefined, this>
, making it impossible to chain useJoins
any further, as ReferenceFields<SomeEntity | undefined> resolves to
undefined`.
This fixes that by using Exclude<T[K], undefined>
Relinquishment of Rights
Please mark following checkbox to confirm that you relinquish all rights of your changes:
- [x] I waive and relinquish all rights regarding this changes (including code, text, and images) to Deepkit UG (limited), Germany. This changes (including code, text, and images) are under MIT license without name attribution, copyright notice, and permission notice requirement.
Closes #366
Fixed in a different way via https://github.com/deepkit/deepkit-framework/commit/e229380fd8fc14b4f4e38a25294a79a124534522