Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ESLint rule for arrow function requiring return type

I’m having below arrow function in my angular project:

this.httpClient.get('url').subscribe((response)=>{

});

In the above code ESLint should throw an error for not specifying return type.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Check the rule @typescript-eslint/explicit-function-return-type. You need to set the option allowTypedFunctionExpressions to false. If you are using .eslintrc:

"@typescript-eslint/explicit-function-return-type": [
  "error",
  {
    "allowTypedFunctionExpressions": false
  }
]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading