我有以下代码
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();
答案 0 :(得分:2)
我认为这是在抱怨您对结果变量没有做任何事情。尝试做
改为await this.afAuth.auth.createUserWithEmailAndPassword(user.email, user.password);
。听起来像是linter错误,而不是编译器错误
要禁用规则(来自tslint
),可以对其进行更新: