diff --git a/docs/usage/UsageWithTypescript.md b/docs/usage/UsageWithTypescript.md index 5de3adaecb..087bf0cc41 100644 --- a/docs/usage/UsageWithTypescript.md +++ b/docs/usage/UsageWithTypescript.md @@ -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` 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: