You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/usage/migrating-rtk-2.md
+51-1Lines changed: 51 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -134,7 +134,7 @@ We've changed `next` to be `(action: unknown) => unknown` (which is accurate, we
134
134
135
135
In order to safely interact with values or access fields inside of the `action` argument, you must first do a type guard check to narrow the type, such as `isAction(action)` or `someActionCreator.match(action)`.
136
136
137
-
This new type is incompatible with the v4 `Middleware` type, so if a package's middleware is saying it's incompatible, check which version of Redux it's getting its types from!
137
+
This new type is incompatible with the v4 `Middleware` type, so if a package's middleware is saying it's incompatible, check which version of Redux it's getting its types from! (See [overriding dependencies](#overriding-dependencies) later in this page.)
138
138
139
139
#### `PreloadedState` type removed in favour of `Reducer` generic
140
140
@@ -723,6 +723,56 @@ We now have a docs page that covers [how to set up Redux properly with Next.js](
723
723
724
724
(At this time, the Next.js `with-redux` example is still showing outdated patterns - we're going to file a PR shortly to update that to match our docs guide.)
725
725
726
+
## Overriding dependencies
727
+
728
+
It will take a while for packages to update their peer dependencies to allow for Redux core 5.0, and in the meantime changes like the [Middleware type](#middleware-type-changed---middleware-action-and-next-are-typed-as-unknown) will result in perceived incompatibilities.
729
+
730
+
It's likely that most libraries will not actually have any practices that are incompatible with 5.0, but due to the peer dependency on 4.0 they end up pulling in old type declarations.
731
+
732
+
This can be solved by manually overriding the dependency resolution, which is supported by both `npm` and `yarn`.
733
+
734
+
### `npm` - `overrides`
735
+
736
+
NPM supports this through an [`overrides`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides) field in your `package.json`. You can override the dependency for a specific package, or make sure that every package that pulls in Redux receives the same version.
Yarn supports this through a [`resolutions`](https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/) field in your `package.json`. Just like with NPM, you can override the dependency for a specific package, or make sure that every package that pulls in Redux receives the same version.
0 commit comments