You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This alpha preview release rewrites the TypeScript types to target TypeScript 4.2+, adds automatic type inference for createStructuredSelector, fixes a longstanding bug with the equalityCheck argument to defaultMemoize and its usage with createSelectorCreator, and updates build tooling.
npm i reselect@next
yarn add reselect@next
This is the first release in several years, due to the original maintainer @ellbee dealing with other obligations. Thanks to him for all his hard work, and for giving additional maintainers access.
The Reselect types were written several years ago and originally targeted TS 2.x versions. As a result, the typedefs requires dozens of overloads to handle varying numbers of arguments (see the legacy typedefs file for examples).
We've completely rewritten the TS typedefs to use modern TS syntax like mapped types. This drastically shrinks the size of the typedefs (from 1000 lines to about 115), and also improves the actual type inference overall.
The updated types do require use of TS 4.2+. We've attempted to keep the final public type names and usage the same, but there may also be some types breakage. We'd appreciate feedback on any meaningful breakage issues so we can make further tweaks if needed.
Given the intent of the improvements, that they're all type-only changes, the attempts to retain backwards compatibility, and TS's own versioning scheme, we're considering this to be a minor version change rather than a major.
The legacy types are still included, and should automatically be used if you are using TS 4.1 and earlier.
Additional Type Fixes
In some cases passing an equalityCheck function to defaultMemoize would not infer the right types for the (a, b) arguments, either when used by itself or as an argument to createSelectorCreator. Those types should now be inferred correctly.
As part of that work, the types had long declared that equalityCheck functions took index: number as a third parameter. That has not been true in the actual JS code since late 2016, but the types weren't updated to match the runtime behavior. That is now fixed.
A new overload of createSelectorCreator has been added that will infer the type of state for the overall selector if all input selectors have the state argument typed.
Build Tooling Updates
Reselect now (finally) uses Babel 7. We're using Github Actions for CI and running type tests against TS4.2+.
Changes
This alpha release is from a still-draft PR, #486, and contains code from:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This alpha preview release rewrites the TypeScript types to target TypeScript 4.2+, adds automatic type inference for
createStructuredSelector
, fixes a longstanding bug with theequalityCheck
argument todefaultMemoize
and its usage withcreateSelectorCreator
, and updates build tooling.This is the first release in several years, due to the original maintainer @ellbee dealing with other obligations. Thanks to him for all his hard work, and for giving additional maintainers access.
We have an open roadmap discussion asking for feedback on a potential Reselect v5 API design, and would appreciate additional input and ideas there.
Changelog
TypeScript Target Version Updated to 4.2+
The Reselect types were written several years ago and originally targeted TS 2.x versions. As a result, the typedefs requires dozens of overloads to handle varying numbers of arguments (see the legacy typedefs file for examples).
We've completely rewritten the TS typedefs to use modern TS syntax like mapped types. This drastically shrinks the size of the typedefs (from 1000 lines to about 115), and also improves the actual type inference overall.
The updated types do require use of TS 4.2+. We've attempted to keep the final public type names and usage the same, but there may also be some types breakage. We'd appreciate feedback on any meaningful breakage issues so we can make further tweaks if needed.
Given the intent of the improvements, that they're all type-only changes, the attempts to retain backwards compatibility, and TS's own versioning scheme, we're considering this to be a minor version change rather than a major.
The legacy types are still included, and should automatically be used if you are using TS 4.1 and earlier.
Additional Type Fixes
In some cases passing an
equalityCheck
function todefaultMemoize
would not infer the right types for the(a, b)
arguments, either when used by itself or as an argument tocreateSelectorCreator
. Those types should now be inferred correctly.As part of that work, the types had long declared that
equalityCheck
functions tookindex: number
as a third parameter. That has not been true in the actual JS code since late 2016, but the types weren't updated to match the runtime behavior. That is now fixed.A new overload of
createSelectorCreator
has been added that will infer the type ofstate
for the overall selector if all input selectors have thestate
argument typed.Build Tooling Updates
Reselect now (finally) uses Babel 7. We're using Github Actions for CI and running type tests against TS4.2+.
Changes
This alpha release is from a still-draft PR, #486, and contains code from:
memoize
type fixes ( @micahbales )createStructuredSelector
inference ( @oatkiller )Full Changelog: v4.0.0...v4.1.0-alpha.0
This discussion was created from the release v4.1.0-alpha.0.
Beta Was this translation helpful? Give feedback.
All reactions