我有以下代码
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();
最佳答案
我认为它是在提示您没有对结果变量做任何事情。尝试只是做
await this.afAuth.auth.createUserWithEmailAndPassword(user.email, user.password);
代替。听起来像是 linter 错误而不是编译器错误
要禁用规则(来自 tslint
),您可以更新它:
关于javascript - 结果已声明,但其值从未在 ionic 3 上读取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52156793/