npm @reduxjs/toolkit 1.2.2

latest releases: 2.3.0, 2.2.8, 2.2.7...
4 years ago

This releases fixes our dev UMD build, and improves type inference for dispatch based on provided middleware.

Changes

Dispatch and Middleware Typings

The Redux core types will modify the type of dispatch based on provided middleware, allowing it to accept parameters other than action objects and return other values. The redux-thunk middleware is an example of this.

RTK's configureStore and getDefaultMiddleware were not correctly picking up the types of the middleware, and were always assuming that redux-thunk was enabled at the type level even if the thunk middleware had been disabled.

This has been fixed, and the store should now correctly pick up the types of both the default and user-provided middleware.

Additional Type Re-Exports

RTK now re-exports the ThunkAction type from redux-thunk, and the Draft type from immer.

Dev UMD fixes

Our dev UMD build was broken due to the recent build configuration changes, and that has now been fixed. This means the sandbox in the Basic Tutorial should be working again.

Changelog

  • correctly infer dispatch from provided middlewares (@phryneas - #304)
  • export ThunkAction and Draft types (@phryneas - #312)
  • fix: UMD dev build by removing runtime usage of require statement (@alex-ketch - #317)

v1.2.1...v1.2.2

Don't miss a new toolkit release

NewReleases is sending notifications on new releases.