Result is declared but its value is never read on ionic 3

Viewed 3680

I have a following code

async register(user: User){
try {
  const result = await this.afAuth.auth.createUserWithEmailAndPassword(user.email, user.password);
  this.userRegister();
}
catch {
  this.showAlert();
}

}

But when I run the command ionic build --release --prod the terminal tells me the following message

  tslint: C:/Users/Mike/Desktop/GuiaCorretor/src/pages/register/register.ts, line: 39
      'result' is declared but its value is never read.

    try {
      const result = await this.afAuth.auth.createUserWithEmailAndPassword(user.email, user.password);
      this.userRegister();
1 Answers

I think it's complaining that you aren't doing anything with your result variable. Try just doing await this.afAuth.auth.createUserWithEmailAndPassword(user.email, user.password); instead. Sounds like a linter error rather than a compiler error

To disable the rule (coming from tslint) you can update it:

https://palantir.github.io/tslint/rules/no-unused-variable/

Related