Description
🔎 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
💻 Code
declare const fn: (() => void) | ((a: number) => void)
declare const x: number;
declare const y: any;
fn.call(null, x); // ok
fn.call(null, y); // error
fn(y); // ok
fn(x); // ok
🙁 Actual behavior
The line marked as // error
gives the following error:
Expected 1 arguments, but got 2.
🙂 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 fixed