Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/152.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 结果已声明,但其值从未在ionic 3上读取_Javascript_Angular_Typescript_Ionic3 - Fatal编程技术网

Javascript 结果已声明,但其值从未在ionic 3上读取

Javascript 结果已声明,但其值从未在ionic 3上读取,javascript,angular,typescript,ionic3,Javascript,Angular,Typescript,Ionic3,我有以下代码 async register(user: User){ try { const result = await this.afAuth.auth.createUserWithEmailAndPassword(user.email, user.password); this.userRegister(); } catch { this.showAlert(); } } 但是当我运行命令ionic build--release--prod时,终端会告诉我以下消息 tsl

我有以下代码

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

但是当我运行命令
ionic build--release--prod
时,终端会告诉我以下消息

  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();

我认为这是在抱怨你没有对结果变量做任何事情。试着去做
等待这个.afAuth.auth.createUserWithEmailAndPassword(user.email,user.password)取而代之。听起来像是林特错误,而不是编译器错误

要禁用规则(来自
tslint
),您可以更新它:


我认为这是在抱怨您没有对
结果
变量做任何事情。尝试执行
等待这个.afAuth.auth.createUserWithEmailAndPassword(user.email,user.password)取而代之。听起来像是一个linter错误而不是编译器错误谢谢!请把你的答案作为一个问题,这样我就可以把这件事标记为已经解决了!