Empty rest parameter type inferred from candidate function with no rest parameters when "best match" contains a contextually typed argument #52227
Labels
Experience Enhancement
Noncontroversial enhancements
Help Wanted
You can do this
Suggestion
An idea for TypeScript
Milestone
Bug Report
π Search Terms
Rest parameter inference contextual
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
When fn1 (and only fn1) contains a contextually typed argument, it is ignored in favour of fn2
π Expected behavior
In all of the examples, fn2 specifies no rest parameters at all.
I would expect functions that do not specify any rest parameters to always be the least preferable candidate (lowest weight?) for rest parameter inference, since "no rest parameters" can always be assigned to any rest parameter type.
The text was updated successfully, but these errors were encountered: