Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/reduxjs/redux into migrat…
Browse files Browse the repository at this point in the history
…e-typetests-to-vitest
  • Loading branch information
aryaemami59 committed Mar 29, 2024
2 parents d8ba2e9 + 991dad0 commit b746ed0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/usage/UsageWithTypescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ export const exampleMiddleware: Middleware<
}
```

:::caution

If you are using `typescript-eslint`, the `@typescript-eslint/ban-types` rule might report an error if you use `{}` for the dispatch value. The recommended changes it makes are incorrect and will break your Redux store types, you should disable the rule for this line and keep using `{}`.

:::

The dispatch generic should likely only be needed if you are dispatching additional thunks within the middleware.

In cases where `type RootState = ReturnType<typeof store.getState>` is used, a [circular type reference between the middleware and store definitions](https://github.com/reduxjs/redux/issues/4267) can be avoided by switching the type definition of `RootState` to:
Expand Down

0 comments on commit b746ed0

Please sign in to comment.