We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx) 2.4.0
Code
interface Test{ show(): string; show(arg: (a:string)=>void): void; show(arg: (a:string, b:number)=>void): void; } declare let t:Test; t.show(); t.show(a=>{}); t.show((a,b)=>{});
Expected behavior: Compile success. Both a=>{} and (a,b)=>{} can infer right type to a and b instead of implicitly has an 'any' type
a=>{}
(a,b)=>{}
a
b
implicitly has an 'any' type
Actual behavior:
index.ts(11,9): error TS7006: Parameter 'a' implicitly has an 'any' type. index.ts(11,11): error TS7006: Parameter 'b' implicitly has an 'any' type.
The text was updated successfully, but these errors were encountered:
Don't over complicated things:
interface Test{ show(arg?: (a:string, b?:number)=>void): void; } declare let t:Test; t.show(); t.show(a=>{}); t.show((a, b) => { });
Sorry, something went wrong.
Duplicate #11936
Note: Don't mark callback parameters as optional
interface Test{ show(arg?: (a:string, b:number)=>void): void; } declare let t:Test; t.show(); t.show(a=>{}); t.show((a, b) => { });
Ooops, sorry, yes I forgot.
No branches or pull requests
TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)
2.4.0
Code
Expected behavior:
Compile success.
Both
a=>{}
and(a,b)=>{}
can infer right type toa
andb
instead ofimplicitly has an 'any' type
Actual behavior:
The text was updated successfully, but these errors were encountered: