4
如何摆脱传递到then
承诺的数据结构的Typescript错误?类型'{}'上不存在属性'count'
我收到以下错误:
Property 'count' does not exist on type '{}'
对于下面的代码:
this.userData.getSocialLinks(this.navParams.get('image_owner_id')).then(socialLinks => {
var i = 0;
for (i=0; i < socialLinks.count; i++) {
if (socialLinks.results[i].social_type == 'TW') {
this.profile.twitter = socialLinks.results[i].social_address;
this.isExistingTW = true;
this.twEntryID = socialLinks.results[i].id;
}
else if (socialLinks.results[i].social_type == 'IN') {
this.profile.instagram = socialLinks.results[i].social_address;
this.isExistingIN = true;
this.inEntryID = socialLinks.results[i].id;
}
}
});
我猜我必须定义socialLinks
莫名其妙,但不能在哪里工作。
作品完美的感谢。 –