Skip to content

Update dependency redux-thunk to v2.4.0 - autoclosed

igswsihw-wmadepbot requested to merge renovate/redux-thunk-2.x into main

This MR contains the following updates:

Package Change Age Adoption Passing Confidence
redux-thunk 2.3.0 -> 2.4.0 age adoption passing confidence

Release Notes

reduxjs/redux-thunk

v2.4.0

Compare Source

This very overdue release makes several major improvements to the TypeScript types, and converts the actual source to TypeScript. Sorry for the delay!

Changelog

TypeScript Improvements

This release fixes several outstanding issues that had been reported with the types. An extra overload has been added to let TS correctly understand some generically-typed values being passed to dispatch, and the overloads have been reworked for additional compatibility.

There's also a new ThunkActionDispatch type that can be used to represent how bindActionCreators turns bound thunks into (arg) => thunkReturnValue.

Additionally, all of the generic args have been giving meaningful names instead of one-letter abbreviations (S -> State, E -> ExtraArgument, etc), and we've added descriptive comments in the type definitions for clarity.

Optional Global Dispatch Type Extension

Most Redux apps have the thunk middleware enabled, but the default Dispatch and bindActionCreator types only know about the standard behavior of a basic Redux store without any middleware. The thunk middleware types add to that type behavior, so that Dispatch knows dispatching a thunk can actually return a value such as a Promise.

We generally recommend inferring the type of dispatch and using that to create reusable types, including creating pre-typed hooks. However, some users may prefer to globally augment the Dispatch type to always use the additional thunk behavior.

You can now import 'redux-thunk/extend-redux' to globally augment the Dispatch type as an opt-in change in behavior.

Codebase Converted to TypeScript

We've gone ahead and converted the actual source to TS. Since the source was only 15-ish lines to begin with, most of the "conversion" time was just trying to convince TS that assigning thunk.extraArgument = createThunkMiddleware was a legal operation :)

We also updated the build tooling:

  • Babel updates
  • Rollup for the UMDs instead of Webpack
  • Github Actions for CI instead of Travis

Finally, the README has been updated with newer instructions and usage information.

What's Changed

New Contributors

Full Changelog: https://github.com/reduxjs/redux-thunk/compare/v2.3.0...v2.4.0


Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this MR and you won't be reminded about this update again.


  • If you want to rebase/retry this MR, click this checkbox.

This MR has been generated by Renovate Bot.

Edited by igswsihw-wmadepbot

Merge request reports