deepkit-framework icon indicating copy to clipboard operation
deepkit-framework copied to clipboard

fix(orm): fix useJoin JoinDatabaseQuery generic for optional properties

Open timvandam opened this issue 2 years ago • 1 comments

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.

timvandam avatar Sep 09 '22 14:09 timvandam

Closes #366

timvandam avatar Sep 09 '22 14:09 timvandam

Fixed in a different way via https://github.com/deepkit/deepkit-framework/commit/e229380fd8fc14b4f4e38a25294a79a124534522

marcj avatar Nov 30 '22 18:11 marcj