redux-devtools
redux-devtools copied to clipboard
fix(compose): generic types for devtools/extension
I wrote generic types for devtools/extension compose function because when passing async thunk-functions in store.dispatch typescript gives an error about type incompatibility.
Argument of type '(dispatch: asyncThunkDispatch) => Promise<void>' is not assignable to parameter of type 'appActionTypes | etc'. ts(2345)
⚠️ No Changeset found
Latest commit: c7e84ff4dc915ed8bf231f7782c98dd6d5c9a8cf
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Can you provide a TS playground that demonstrates the type error you're getting? A simple store setup with just Redux Thunk seems to be working for me and I'd just like to see what the use case is before accepting this PR.
https://codesandbox.io/s/react-playground-forked-2nhxnd?file=/index.ts Same problem with your code
I'm trying out the new type here. The newComposeWithDevTools is typed the same way as in this PR, but I'm still getting a type error.
Additionally, my earlier point still stands that you can't have multiple enhancers that have different StoreExt generics and have it type-check properly. Here is an example of that not working properly after this PR.
Sorry for a long waiting.
https://codesandbox.io/s/react-playground-forked-w6ox9w
I wrote custom interface as in PR (compose.ts) and small redux-store.
Watch in index.ts 5 line: here is async-dispatch without error. But if you switch in store.ts to your composeWithDevTools, you will get an error in index.
Sorry for the delayed response.
I just released @redux-devtools/[email protected] with https://github.com/reduxjs/redux-devtools/pull/1323 that should fix this issue. Can you try it out when you get a chance to see if it resolves this issue for you?
I've tested the change on the CodeSandboxes provided in this thread and it seems to work correctly, so I'm closing this for now. Let me know if you still have issues.
Sorry for the delayed response.
I just released
@redux-devtools/[email protected]with #1323 that should fix this issue. Can you try it out when you get a chance to see if it resolves this issue for you?
Yeah, it works!