-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type inference error in multi-olverloads function body #25865
Comments
From FAQs: A function or a method implementation signature is not part of the overloads. Add another overload to function a: function a(value: C1 | null): string;
function a(value: C2 | null): string;
function a(value: C1 | C2 | null): string;
function a(value: C1 | C2 | null): string {
return "";
} |
@j-oliveras that was going to be my first response too, but then I thought the error is a bit illogical. In the line where the error occurs, we know that value is either a |
@AlCalzone In this case, it is duplicate of #14107 and #1805. |
And possibly related: #7294 type Foo = ((val: number) => any) | ((val: string) => any);
let f: Foo;
f(1); // error: Type Foo lacks a call signature |
indeed duplicate of #14107 |
@j-oliveras I am not the owner of ".d.ts" file that describes the overloads. I can't add the overloads as you suggest. |
TypeScript Version: 2.9
Search Terms:
method overloads when pipe
Code
Expected behavior:
no errors in the function "c" because is exactly the same as function "b"
Actual behavior:
error in function "c":
Playground Link:
PlayGround
Related Issues:
#25637
#25791
#25826
The text was updated successfully, but these errors were encountered: