github reduxjs/reselect v4.1.4

latest releases: v5.1.1, v5.1.0, v5.0.1...
2 years ago

This release has (you guessed it) more fixes to the TS types: a change to parameter merging that fixes breakage with selectors and RTK Query's API state, a simplification of the OutputSelectorFields type to improve selector variable readability, another update to parameter merging to flag nested never fields as compile errors, and a fix to createStructuredSelector parameters to resolve a lib compilation problem.

Changelog

More TS Fixes

The parameter merging fixes in 4.1.3 tried to "unwrap/expand" the parameter types to make them more readable, such as showing intersected objects as {a, b, c} instead of {a} & {b} & {c}. This was done with a recursive expansion type. That turned out to break with the complex state types used by RTK Query. We've updated the type expansion to only be a single level instead, which fixes the compilation issue.

The OutputSelectorFields type previously took two generics: the Combiner function, and a Result type. This led to extra values being shown in hover previews for selectors. By inferring Result = ReturnType<Combiner>, we were able to drop the second generic and cut down on the amount of types shown in previews.

A user noted that intersected objects with top-level incompatible fields (like {a: string} & {a: number}) resulted in empty objects, but no compile error. We've updated the parameter merging to flag those as never and catch the problem at compile time. Deeper nested incompatible fields should already be caught by TS.

The previous fix to createStructuredSelector missed a step in the spreading process, which has now been fixed.

What's Changed

Full Changelog: v4.1.3...v4.1.4

Don't miss a new reselect release

NewReleases is sending notifications on new releases.