.call
on an union with different arguments counts fails when passing any
#58468
Labels
Help Wanted
You can do this
Possible Improvement
The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone
🔎 Search Terms
call union expected arguments but got
🕗 Version & Regression Information
Before version 4.5 both the
.call
s in the example below failed. Since then,.call(null, something-not-any)
is accepted and.call(null, something-any)
failes.⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.5.0-beta#code/CYUwxgNghgTiAEYD2A7AzgF3gMxQLngApCBKeAXgD54A3JAS2DIB8jCoCUBXAWwCMQMMlVoMmAKHGhIsBMnRYAHp14CYAbinhocRKkzwAngSgpDm8bgB0YKBAiFu9gDTxFJTddv3HXF0Y9JXEJDQOD3CyA
💻 Code
🙁 Actual behavior
The line marked as
// error
gives the following error:🙂 Expected behavior
It should be accepted, the same as the other lines are accepted.
Additional information about the issue
No response
TODO for myself: Remove
@ts-ignore
in https://github.com/babel/babel/blob/main/packages/babel-generator/src/printer.ts#L717 once this is fixedThe text was updated successfully, but these errors were encountered: