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

Circular RootState when using createAsyncThunk.withTypes #2895

Closed
mezojm10 opened this issue Nov 11, 2022 · 3 comments
Closed

Circular RootState when using createAsyncThunk.withTypes #2895

mezojm10 opened this issue Nov 11, 2022 · 3 comments

Comments

@mezojm10
Copy link

Hello there!

I'm trying to define a pre-typed version of createAsyncThunk as described here in the docs, but I end up with a circular import for RootState that errors my slice (because I'm using createAsyncThunk in a slice that imports the RootState type from the store file that also imports the same slice I'm using).

image

image

Reproduction:
https://codesandbox.io/s/redux-starter-kit-circular-slice-dependencies-example-forked-dferhs?file=/src/counterA.tsx
I created a minimal codesandbox for reproduction you can check it out here.

I checked the older issues and none of the fixes worked for me.
Issues I checked:
#2770
#1126

@phryneas
Copy link
Member

That doesn't look like a TypeScript error at all - this is a runtime error we fixed over in #2885 that will be released within the next few days as 1.9.1.
Meanwhile, you can try to work with the CodeSandbox CI build from that PR.

@mezojm10
Copy link
Author

Thank you. Yeah the CI build version is working fine for now, I'll wait until 1.9.1.

@Naggertooth
Copy link

This saved my hours

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants