This bugfix release fixes issues with "TS type portability" errors, improves build artifact tree shaking behavior, and exports some additional TS types.
Changelog
TS Type Portability
We've had a slew of issues reported around "TS type portability" errors, such as:
The error messages are typically along the lines of:
Type error: The inferred type of
'configureStore'
cannot be named without a reference to'@reduxjs/toolkit/node_modules/redux'
. This is likely not portable. A type annotation is necessary.
@aryaemami59 did some deep investigation and concluded these were due to a mixture of using interface
instead of type
in most places, not pre-bundling our TS typedefs, and not exporting some of the unique symbols we use internally.
Arya put together a highly detailed writeup and set of fixes in #4467: Fix: TypeScript Type Portability Issues, and that appears to resolve all of those issues we've seen. Thank you!
Other Changes
Arya also did significant work to improve RTK's treeshaking, tweaking internal definitions to let bundlers better separate out unused code.
We've exported additional types like UpdateDefinitions
and RetryOptions
, per request.
listenerMiddleware.withTypes()
methods now allow passing in an ExtraArgument
generic.
What's Changed
- Fix: TypeScript Type Portability Issues by @aryaemami59 in #4467
- Export UpdateDefinitions from toolkit/query by @joekrill in #4519
- feat: Adds ExtraArgument to withTypes for listenerMiddleware. by @antondalgren in #4517
- Improve treeshakeability of build artifacts by @aryaemami59 in #4435
- Export RetryOptions by @markerikson in #4529
Full Changelog: v2.2.6...v2.2.7