getParent not useable in child view with TypeScript when adding actions to parent #1851
Labels
help/PR welcome
Help/Pull request from contributors to fix the issue is welcome
Typescript
Issue related to Typescript typings
Bug report
Sandbox link or minimal reproduction code
Click here
Describe the expected behavior
I should be able to properly type the return value of
getParent
when using a model with actions as parent.Describe the observed behavior
As long as there are no actions defined in the parent model,
getParent
accepts the type and everything works as expected. As soon as I add any action to the parent model, its type becomesany
. If on the other hand I remove thegetParent
function from the child model after adding an action to the parent model, the parent type will be correct again. There seems to be something wrong when using bothgetParent
and actions on the parent combined. Individually I see no errors.Edit: same thing happening with
getParentOfType
No action:
No view:
In combination:
Edit:
Working when getParent is used externally, but this solution will not be maintainable for large applications
The text was updated successfully, but these errors were encountered: