This release updates the TS types to avoid TypeScript recursion limitations and improve backwards compatibility, adds doc comments to most of the TS types and field declarations, and fixes a bug with the behavior of the resultEqualityCheck
option in defaultMemoize
.
Changelog
TypeScript Updates
We saw cases where composition of selectors past 8-9 levels of nesting would cause TS to fail with a "Type instantiation is excessively deep and possibly infinite" error.
We've updated the types to allow additional recursion up to about 15 levels of nested selectors. Hopefully this is enough for most usages :)
The OutputSelector
generic arguments had been swapped during the rewrite for 4.1, which made it incompatible with other code that attempted to import and use that type. We've reverted the generic arguments to their previous order to fix compatibility.
defaultMemoize
adds a .clearCache()
field to its return value. While the real caching is done by the memoizedResultFunc
function, the actual returned selector has also been run through the memoizer and thus also has a .clearCache()
field attached, but that wasn't captured in the types. We've updated the types to reflect that.
We've also added doc comments to almost all of the internal types for clarity, as well as comments to the returned fields on selectors.
resultEqualityCheck
Behavior
The resultEqualityCheck
option wasn't saving the result if there was a cache hit, which is now fixed.
What's Changed
- Update defaultMemoize cache even if resultEqualityCheck is a hit by @tetslee in #535
- Make OutputSelector backwards compatible w/ < 4.1.0 version by @eXamadeus in #536
- Clarify description of createSelector by @acrollet in #539
- Clean up OutputSelector typing and fix bug with memoize function types by @eXamadeus in #537
New Contributors
Full Changelog: v4.1.1...v4.1.2