You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type '{ children: { claims: true; journalEntries: true; }; }' is not assignable to type 'FindOptionsRelationByString | FindOptionsRelations<User>'.
Types of property 'children' are incompatible.
Type '{ claims: true; journalEntries: true; }' is not assignable to type 'boolean | readonly (boolean | FindOptionsRelations<Child> | undefined)[] | undefined'.
Object literal may only specify known properties, and 'claims' does not exist in type 'readonly (boolean | FindOptionsRelations<Child> | undefined)[]'.ts(2322)
Note the addition of [] which doesn't make sense when writing code.
Causes runtime error: EntityPropertyNotFoundError: Property "0" was not found in "Child". Make sure your query is correct.
Can workaround with ts-expect-error:
relations: {
children: {
// @ts-expect-error TypeORM types want this to be an [] becuase it's silly
// That causes runtime error: EntityPropertyNotFoundError: Property "0" was not found in "Child". Make sure your query is correct.
claims: true,
journalEntries: true,
},
},
Expected Behavior
FindOptionsRelations types to be modified for this nested case
Actual Behavior
Types are wrong, error messages shown above
Steps to Reproduce
As above
My Environment
Dependency
Version
Operating System
Node.js version
16.15.1
Typescript version
4.8.2
TypeORM version
0.3.9
Are you willing to resolve this issue by submitting a Pull Request?
✅ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
The text was updated successfully, but these errors were encountered:
it's occurs because your property type is "readonly" and the FindOptionsRelationsProperty interface does not handle this.
May it be fixed just adding to FindOptionsRelationsProperty
Issue Description
Have an Entity
Have an Entity
Try and select
user+children+claims
:Get compile time error:
Such that you have to write code:
Note the addition of
[]
which doesn't make sense when writing code.Causes runtime error:
EntityPropertyNotFoundError: Property "0" was not found in "Child". Make sure your query is correct.
Can workaround with
ts-expect-error
:Expected Behavior
FindOptionsRelations types to be modified for this nested case
Actual Behavior
Types are wrong, error messages shown above
Steps to Reproduce
As above
My Environment
Are you willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: