Closed
Description
π Search Terms
None
π Version & Regression Information
Tested on the nightly build.
β― Playground Link
tsx function foo(a: boolean): void function foo(a: number): void function foo(a: boolean|number) {} type InferArgs<T> = T extends (...args: infer U) => void ? U : never; type Args = InferArgs<typeof foo...
Playground Link
π» Code
function foo(a: boolean): void
function foo(a: number): void
function foo(a: boolean|number) {}
type InferArgs<T> = T extends (...args: infer U) => void ? U : never;
type Args = InferArgs<typeof foo>;
let a: Args = [true];
π Actual behavior
When inferring the function parameters, only one of the function signature is used.
Here, Args
is [number]
, which raises an error in the last line.
π Expected behavior
When inferring the function parameters, the union of the different signatures should be returned.
Here, Args
should be [number]|[boolean]
.
Additional information about the issue
No response