Closed
Description
While I'm trying to work on #758, I found this behaviour which seems incorrect.
I have an error with below code and to make it silent I had to explicitly type every chain of higher order function.
// with errors
const x = (arg1: string) => {
const tempVar1 = 'temporary value1';
const tempVar2 = 'temporary value2';
return (arg2: number): string => 'foo';
}
// without error(have to explicitly type every chain)
const x = (arg1: string): (arg2: number) => string => {
const tempVar1 = 'temporary value1';
const tempVar2 = 'temporary value2';
return (arg2: number): string => 'foo';
}
It seems like the code is only covering the case that is returning function right away inside of BlockStatement. I think it can be improved so I made a PR #894 Initially I only made a PR but I'm writing this issue for better history tracking.
Aside from this PR, can you review my other PRs too? If you are not satisfied with my implementation, please leave me some comments so that I can apply your feedback. Hope it's not that bad try this time.
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
2.0.0 |
@typescript-eslint/parser |
2.0.0-alpha.0 |
TypeScript |
3.5.1 |
ESLint |
6.0.0 |
node |
11.15.0 |
yarn |
1.16.0 |