Function.prototype.bind typings do not work properly when supplied a function with variadic arguments. #42196
Labels
Design Limitation
Constraints of the existing architecture prevent this from being fixed
Bug Report
If you pass a function that might behave differently when supplied different arguments, the resulting type does not properly accommodate all call patterns.
I ran into this while trying to figure out how TypeScript handled situations similar to RxJS's
bindNodeCallback
andbindCallback
, which suffers from similar problems.🔎 Search Terms
bind
bind "Arguments for the rest parameter"
🕗 Version & Regression Information
versions 3.3.* - 4.1.3
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
I got a compilation error for a perfectly valid call of my bound function.
🙂 Expected behavior
The return type (the type of
r
) should beC
, and the code should compile successfully.The text was updated successfully, but these errors were encountered: