This releases fixes several TS issues and one runtime issue that were reported with the release of 4.1.0.
Changelog
TypeScript Fixes
All these reported issues should now be fixed:
createSelector
calls with 12 or more input selectors were causing TS to fail with a "Type instantiation is excessively deep" error. After this update,createSelector
should now support up to 29 input selectors before TS has type issues. (and if you've got more than 29 input selectors.... what are you doing? :) )- Passing multiple input selectors with mismatched argument types should have been failing to compile, but was being silently accepted (ie
(a: number) => 42, (b: string) => 123
) - The
OutputParametricSelector
type, which is re-exported by Redux Toolkit, was inadvertently left out of the list of Reselect type exports during the rewrite and caused RTK builds to fail - Input selectors that were typed to return
SomeType | undefined
were causing the entire selector to be typed as possibly returningundefined
Caching Undefined Values
The previous internal cache logic had a couple of if (foundValue !== undefined)
checks inside, but that broke cases where a selector intentionally wanted to return undefined
as the actual result.
The cache logic has been updated to use an internal sentinel value as the NOT_FOUND
result instead, allowing undefined
to be correctly cached and returned.
What's Changed
- Split out optional last argument (memoizeOptions) into it's own overload by @eXamadeus in #530
- increase subselector number by @phryneas in #528
- build intersection type instead of union type in
GetStateFromSelectors
by @phryneas in #529 - Update cache to support storing a value of
undefined
by @markerikson in #532
New Contributors
Full Changelog: v4.1.0...v4.1.1