TypeScript: HasManyThroughRelationContract missing throughModel? #4569
Unanswered
EmilyRagan
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am working with
@adonisjs/lucid
v18.3.0, but the types that I am concerned with seem to be the same in the current code. I am using TypeScript 4.6.4. After narrowing aRelationshipContract
to aHasManyThroughRelationContract
usingisType
, I am finding that TypeScript tells me I cannot access thethroughModel
property that should come fromBaseRelationContract
. When debugging and inspecting the relationship object,throughModel
does exist, and using it actually works as I hoped it would, but TypeScript yells at me about it. Why isthroughModel
not available onHasManyThroughRelationContract
and what is the intended way to access the model for the "through" class instead?https://github.com/adonisjs/lucid/blob/2a2bd22c2261f2548f4d794131b4b86fcdaea829/src/types/relations.ts#L146-L152
https://github.com/adonisjs/lucid/blob/2a2bd22c2261f2548f4d794131b4b86fcdaea829/src/types/relations.ts#L532-L535
Beta Was this translation helpful? Give feedback.
All reactions