Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast doesn't seem to work in combination with types.references #1760

Open
3 tasks done
RickLucassen opened this issue Aug 13, 2021 · 0 comments
Open
3 tasks done

Cast doesn't seem to work in combination with types.references #1760

RickLucassen opened this issue Aug 13, 2021 · 0 comments
Labels
bug Confirmed bug help/PR welcome Help/Pull request from contributors to fix the issue is welcome

Comments

@RickLucassen
Copy link

Bug report

  • I've checked documentation and searched for existing issues
  • I've made sure my project is based on the latest MST version
  • Fork this code sandbox or another minimal reproduction.

Sandbox link or minimal reproduction code
https://codesandbox.io/s/mobx-state-tree-todolist-forked-zcdbg

Describe the expected behavior
I have a function that accepts an instance of a model, when calling this function from within an action on that model and passing self as an argument typescript won't accept it. So using cast would make typescript happy again.

Describe the observed behavior
Using cast doesn't work when the model has a types.references present. An error is thrown: "Two different types with this name exist, but they are unrelated."

@jamonholmgren jamonholmgren added bug Confirmed bug help/PR welcome Help/Pull request from contributors to fix the issue is welcome labels Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug help/PR welcome Help/Pull request from contributors to fix the issue is welcome
Projects
None yet
Development

No branches or pull requests

2 participants