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

feat(orm): exclude function properties from `FieldName` type

Open Char2sGu opened this issue 3 years ago • 1 comments

Summary of changes

Exclude function properties from FieldName type.

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.

Char2sGu avatar May 18 '22 16:05 Char2sGu

Types will not be computed when its argument is another generic type argument, thus we might have to use many type assertions in our code, which destroys the user experience:

function fn<Entity extends { username: string }>() {
  const field: FieldName<Entity> = "username"; // this throws a type error unless we use `as FieldName<Entity>`
}

Therefore this PR cannot be merged for now, except we find a solution some day.

Char2sGu avatar May 30 '22 09:05 Char2sGu