How to get rid of Typescript errors for a data structure passed in a promise then?
I get the following error:
Property 'count' does not exist in type '{}'
For the following code:
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;
}
}
});
I assume that I need to somehow determine socialLinks, but I can not decide where.
source
share