Function inference fails when a final argument is supplied after rest via destructured tuples #43122
Labels
Fix Available
A PR has been opened for this issue
Needs Investigation
This issue needs a team member to investigate its status.
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
Bug Report
I'm not sure whether inference failures are usually classified as suggestions or bugs. Sorry if I've assigned this the wrong label!
📖 Context / Introduction
I'm trying to improve the typings for an open source library called reselect. Their
createSelector
function first takes in an arbitrary amount of "selector" functions that take in one parameter as a given state type, and then takes in one final additional function which combines the results of the previous functions. I have an implementation, but inference isn't working as I expect.⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
In the
createSelector
call, all of thex
parameters have an implicit type ofany
, instead ofExampleState
.Observations:
any
, inference works.For some reason, the compiler is having difficulty inferring the rest parameters in this case.
🙂 Expected behavior
I would expect the type system to infer that the
x
parameter of all functions except the last isExampleState
.The text was updated successfully, but these errors were encountered: