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
[ x ] I've checked documentation and searched for existing issues
[ x ] I've made sure my project is based on the latest MST version
[ x ] Fork this code sandbox or another minimal reproduction.
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 becomes any. If on the other hand I remove the getParent 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 both getParent 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:
Hey @patrickschmelter - I'm sorry it took so long for us to get back to you. Thanks for the details. I'm going to label this as a TypeScript issue, which we know is a big challenge for the codebase overall.
Once we figure out where this lands in priorities, hopefully I'll have some updates. In the meantime, we would welcome any PRs to improve TS 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:
![noaction](https://user-images.githubusercontent.com/33024202/148215965-acead9fb-cb83-4011-ac06-0e95f82eb7de.png)
No view:
![noview](https://user-images.githubusercontent.com/33024202/148215971-3cb0f087-27dc-46e3-9f9d-7f9154748a56.png)
In combination:
![any1](https://user-images.githubusercontent.com/33024202/148215847-a5194f39-67f5-44ba-ac05-9bd41ad9a97f.png)
![any2](https://user-images.githubusercontent.com/33024202/148215849-aae2f8f3-4fbe-4e35-9e0b-08e66f277d23.png)
Edit:
![externally](https://user-images.githubusercontent.com/33024202/148217227-7efd13a9-aa2b-4b6a-a08d-4740ee5d246e.png)
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: