-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[explicit-function-return-type] Don't report when using an explicit variable type with an arrow function #149
Comments
Is this the same problem? type Wat = () => string[]
// Missing return type on function.eslint(@typescript-eslint/explicit-function-return-type)
let fn: Wat = () => {
return []
} type Wat = () => string[]
// no errors or warnings
let fn: Wat
fn = () => {
return []
} |
@codepunkt Yes. |
@gilbsgilbs can i help? |
@codepunkt I don't think so. I already made a PR that adds an option to ignore this rule when the function expression is typed. Just need to wait for merge and release. |
I see the latest changes have been published, but I still get an error when writing this:
|
@saranshkataria thanks. I think it was only released as alpha at the moment. Just to be sure:
|
Yup, as @gilbsgilbs mentioned, this is only on the automatically released canary tag right now. In future, please keep an eye on the releases section of the repo to see if PRs have released. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Nevermind, I just saw this issue that explains it. For anyone following along, the rule posted further up in the comments is incorrect. It should be:
|
May I ask why we need to set a rule for this? What is the alternative, and why don't we have it ignore missing return types for react components by default? |
Repro
Expected Result
Neither errors nor warnings
Actual Result
Additional Info
Versions
@typescript-eslint/eslint-plugin
1.1.0
@typescript-eslint/parser
1.1.0
eslint-plugin-react
7.12.4
react
16.7.0
react-dom
16.7.0
TypeScript
3.2.4
ESLint
5.12.1
node
8.11.3
npm
5.6.0
The text was updated successfully, but these errors were encountered: