4

I am implementing a working JS function to typescript, but I'm getting an error on parameters: "error, success"

[tslint] Parentheses are required around the parameters of an arrow function definition (arrow-parens)

function chapa() {
  console.log('altered');
  TouchID.isSupported()
  .then(authenticate)
  .catch(error => {
    AlertIOS.alert('TouchID not supported');
  });
}

so the "error" is underlined with error, with this message:

[tslint] Parentheses are required around the parameters of an arrow function definition (arrow-parens)

how should I pass then the "error" parameter?, cheers

1
  • 2
    So add () around the parameters like it says.... If you do not understand the error messages, look them up, they typically have solutions. eslint.org/docs/rules/arrow-parens Commented Apr 4, 2018 at 1:34

2 Answers 2

4

Just as it says, put parentheses around the parameter:

.catch((error: any) => {

Sign up to request clarification or add additional context in comments.

1 Comment

hi , thanks, but it also needed the type, so (error : any)
4

If you'd rather not add parentheses around the parameter (it's not strictly required by Typescript), add the following to the rules object in your tslint.json file.

"arrow-parens": [true, "ban-single-arg-parens"]

Check out https://palantir.github.io/tslint/usage/configuration/ and https://palantir.github.io/tslint/rules/arrow-parens/ for more details.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.