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
The inferred type of a selector instance doesn't preserve the extra parameters' names. Instead they are called params_0, params_1, etc... See example below:
As you can see, parameter itemId is now called params_0. From a consumer perspective, this parameter is ambiguous and impossible to understand. How can this be fixed? I honestly don't think I'm doing anything wrong here.
Version: 4.1.6
The text was updated successfully, but these errors were encountered:
NordlingDev
changed the title
createSelector with additional parameters doesn't preserve names
createSelector signature with additional parameters doesn't preserve names
Oct 13, 2022
One is that we have to do some extremely complex type transformations to figure out "the tightest possible acceptable combination of parameters from all input functions".
Another is, what would happen if you had multiple input functions, with the same listed arguments, but you gave them different names? What name should get used for the result?
It might hypothetically be possible to do something that preserves the names - I'm honestly not sure.
But given how complex the types are, this is going to be extremely low priority for us to look at, and I generally doubt that there's a solution that can preserve the names well.
@markerikson I'm not too familiar or experienced with the implementation, but if the incoming parameters were instead provided by one single explicitly typed object, then there is no point to preserve the names as they're declared in the object.
The inferred type of a selector instance doesn't preserve the extra parameters' names. Instead they are called
params_0
,params_1
, etc... See example below:The inferred type signature of this selector becomes:
As you can see, parameter
itemId
is now calledparams_0
. From a consumer perspective, this parameter is ambiguous and impossible to understand. How can this be fixed? I honestly don't think I'm doing anything wrong here.Version: 4.1.6
The text was updated successfully, but these errors were encountered: