v2.4.0
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
- Change misleading parameter name for overload of ThunkDispatch by @jmrog in #216
- --save no longer needed by @JoeCortopassi in #217
- Allow action to be typed with any by @laat in #219
- Add overload for bindActionCreators by @RMHonor in #224
- promote gender neutral docs by @beatfactor in #234
- Clarify terminology by @jmm in #237
- Provide more informative names for TypeScript type params by @agwells in #243
- Add peer dependency on redux 4.0 by @hedgepigdaniel in #251
- chore: remove 2015 preset and add env by @hozefaj in #236
- #248 Add union overload to ThunkDispatch by @Philipp91 in #255
- fix: extraThunkArgument types by @jedmao in #260
- Upgrade dependencies by @jedmao in #261
- Add Prettier by @jedmao in #262
- fix: typo TExtraThunkARg -> TExtraThunkArg by @jedmao in #263
- declare this package as having no side effects by @VincentBailly in #267
- Reflect rename of Redux Starter Kit by @travigd in #270
- Correct destructuring example by @telegraham in #272
- Fix link by @mhienle in #276
- feat(ts): add Dispatch overload to redux module by @iamandrewluca in #278
- docs: fix link for
applyMiddleware
by @iamandrewluca in #279 - Improved wording in README.md by @haricharanbole in #293
- chore: add yarn add line by @RichardBray in #305
- Use "sh" instead of "js" in install instructions by @EvanHahn in #312
- Remove redundant
|
by @Philipp91 in #317 - Use GitHub Actions by @nickmccurdy in #318
- Update TS dev tooling and GH Actions workflow by @markerikson in #320
- Move Redux module type extension into a separate imported file by @markerikson in #321
- Add CodeSandbox CI by @markerikson in #323
- Convert codebase to TS and update build tooling by @markerikson in #322
- Remove Webpack config and try test build by @markerikson in #324
New Contributors
- @jmrog made their first contribution in #216
- @JoeCortopassi made their first contribution in #217
- @laat made their first contribution in #219
- @RMHonor made their first contribution in #224
- @beatfactor made their first contribution in #234
- @jmm made their first contribution in #237
- @agwells made their first contribution in #243
- @hedgepigdaniel made their first contribution in #251
- @hozefaj made their first contribution in #236
- @Philipp91 made their first contribution in #255
- @jedmao made their first contribution in #260
- @VincentBailly made their first contribution in #267
- @travigd made their first contribution in #270
- @telegraham made their first contribution in #272
- @mhienle made their first contribution in #276
- @iamandrewluca made their first contribution in #278
- @haricharanbole made their first contribution in #293
- @RichardBray made their first contribution in #305
- @EvanHahn made their first contribution in #312
- @nickmccurdy made their first contribution in #318
- @markerikson made their first contribution in #320
Full Changelog: v2.3.0...v2.4.0