错误TS2339:类型“对象"上不存在属性“电子邮件" [英] error TS2339: Property 'email' does not exist on type 'Object'
问题描述
我正在使用角度5,但出现错误,代码如下:
I'm using angular 5 and i got an error, heres the code :
signIn(provider) {
this._auth.login(provider).subscribe(
(data) => {
console.log(data);
this.hideForm = false;
this.emaill = data.email;
this.nom = data.last_name;
this.prenom = data.first_name;
this.profileImage = data.image;
})
}
错误是:
src/app/authentification/authentification.component.ts(34,28):错误TS2339:类型"Object"上不存在属性"email".src/app/authentification/authentification.component.ts(35,25):错误TS2339:类型"Object"上不存在属性"last_name".src/app/authentification/authentification.component.ts(36,28):错误TS2339:类型"Object"上不存在属性"first_name".src/app/authentification/authentification.component.ts(37,34):错误TS2339:类型"Object"上不存在属性"image".
src/app/authentification/authentification.component.ts(34,28): error TS2339: Property 'email' does not exist on type 'Object'. src/app/authentification/authentification.component.ts(35,25): error TS2339: Property 'last_name' does not exist on type 'Object'. src/app/authentification/authentification.component.ts(36,28): error TS2339: Property 'first_name' does not exist on type 'Object'. src/app/authentification/authentification.component.ts(37,34): error TS2339: Property 'image' does not exist on type 'Object'.
推荐答案
在第三行用(data:any)
替换(data)
.
这篇关于错误TS2339:类型“对象"上不存在属性“电子邮件"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!