#4887·redux

中间件和 `configureStore` 的类型定义不会传播自定义动作类型

作者: markboyall创建于 2026年6月17日更新于 2026年7月10日
标签TypeScript

We are migrating a fairly old Redux application to the latest version. However, the type definitions for the current version seem to have a few issues related to the action type. Specifically, it is sometimes simply not propagated or not available when it should be. The first example of this is the `Middleware` type. `next` is simply defined as taking `unknown` when this should be our action, specifically. It's a little unclear, but perhaps `next` and the return value are meant to be of the `Dispatch` type being passed in already? This means that the "simple" code actually does not compile because the `action` parameter is of the wrong type.