Open Philipp91 opened 6 months ago
I've updated the bug to reflect the error that this (new) extension gives me.
Workaround (or solution?):
After installing the library, in node_modules/@redux-devtools/extension/lib/types/index.d.ts
and node_modules/@redux-devtools/extension/lib/types/logOnly.d.ts
, change all occurrences of StoreEnhancer<...>
to StoreEnhancer<... & {}>
.
Note that you shouldn't be using either the core redux
package or @redux-devtools/extension
directly in your own code today. Instead, use Redux Toolkit's configureStore
, which sets that up for you automatically:
Right. Still.
I think this TypeScript error happens irrespective of what APIs I call, and just because of the mere existence of node_modules/@redux-devtools/extension/lib/types/index.d.ts
in my TypeScript inputs -- and that wouldn't go away with the Toolkit.
(I'm lazy about such a migration... Despite the claim "This is a one-time step, and all of the existing reducers and middleware will continue to work as-is." I ran into TypeScript errors last time and decided to postpone this.)
@Philipp91 fwiw, that should go away with RTK and configureStore
, because RTK does not depend on @redux-devtools/extension
itself - it inlines some of the types. So yeah, migrating the store setup to RTK would be one way to fix this.
I'd also recommend checking to see if you somehow have multiple copies of redux
in your node_modules
.
Okay thanks, I've managed to migrate with reasonable effort and I can confirm that the issue doesn't show up there. As you suspected, it doesn't install the redux-devtools module at all then.
(No multiple copies. I believe the error comes from a misalignment of redux-devtools code with the updated redux code I linked in the opening post.)
Using:
I get:
Maybe this was broken by https://github.com/reduxjs/redux/commit/5a084a62fda9ebf39ffa969458d9950b4f051688: