-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Bug: Property '[Symbol.observable]' is missing in type - useSelector TS error #3141
Comments
Make sure you're on the latest version of I cannot reproduce the type issue with the upgraded version ☝️ |
no, the |
I'm investigating this, for my own reference this is a simplified repro that doesn't involve For some weird reason the type for the function App() {
- const [state, send, service] = useMachine(toggleMachine);
+ const [state, send, service] = useMachine<ToggleMachineContext, ToggleMachineEvent>(toggleMachine); This is, of course, less than ideal - so I'm just proposing as a temporary workaround for this issue. However, this only "fixes" the problem presented on this codesandbox and your original issue is a different issue. Could you try to prepare a repository for this problem (since you were not able to repro that on codesandbox)? |
I was able to slim down the repro case for this issue, even more, see this TS playground. It's quite fascinating because I was able to annotate 4 (sic!) places that are required to be there to trigger the problem. When uncommenting any of them the problem goes away. Luckily, I was also able to figure out a fix for this using At the same time I think that we should hide almost everything from the |
Description
Hi, I'm migrating from old @xstate/react: 0.8.* and updating the code
I set machine types by
createMachine<ToggleMachineContext, ToggleMachineEvent>({})
and try to useuseSelector
to get value from machinecontext
but I get an error :/What I do wrong?
Could you please provide the example with working TS types?
Thank you!
In codesandbox I get another error :/
Expected result
No errors expected
Actual result
Reproduction
https://codesandbox.io/s/still-breeze-8iqd6w?file=/src/index.tsx
Additional context
The text was updated successfully, but these errors were encountered: