This release candidate adds a new isAction
predicate that can be used as a TS type guard, and exports the existing internal isPlainObject
util.
Note that we hope to release Redux Toolkit 2.0, Redux core 5.0, and React-Redux 9.0 by the start of December! (If we don't hit that, we'll aim for January, after the holidays.)
See the preview Redux Toolkit 2.0 + Redux core 5.0 Migration Guide for an overview of breaking changes in RTK 2.0 and Redux core.
npm install redux@next
yarn add redux@next
Changes
isAction
Predicate
We recently added an isAction
predicate to RTK, then realized it's better suited for the Redux core. This can be used anywhere you have a value that could be a Redux action object, and you need to check if it is actually an action. This is specifically useful for use with the updated Redux middleware TS types, where the default value is now unknown
and you need to use a type guard to tell TS that the current value is actually an action:
We've also exported the isPlainObject
util that's been in the Redux codebase for years as well.
What's Changed
- Add isAction type predicate by @EskiMojo14 in #4620
- export isPlainObject by @EskiMojo14 in #4621
- Update build tooling for 5.0 by @markerikson in #4623
Full Changelog: v5.0.0-rc.0...v5.0.0-rc.1