You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript Version:
1.9.0 Atom-TypeScript plugin Version:
8.11.0 Atom Version:
1.7.4 Code method of Class
setProfiles(newProfiles: IProfiles[]){letneedSearch=true;// By default, the variable is of type// this.stg.profiles: IProfiles[] | undefinedif(!this.stg.profiles){this.stg.profiles=[];needSearch=false;}// On the line below the variable type is defined as// this.stg.profiles: IProfiles[]if(!angular.isArray(newProfiles))returnthis.stg.profiles;newProfiles.map((profile)=>{if(!profile||!profile.id)return;constindex=needSearch ? this.getProfileIndex(profile.id) : -1;if(index>=0){// However, on the line below the variable type is defined as// this.stg.profiles: IProfiles[] | undefinedthis.stg.profiles[index]=profile;}else{// And in the line below too// this.stg.profiles: IProfiles[] | undefinedthis.stg.profiles.unshift(profile);}});// Agin, On the line below the variable type is defined as// this.stg.profiles: IProfiles[]returnthis.stg.profiles;}
As you can see from the comments, the type of a variable is not defined clearly in the callback function.
Why is this happening? How can I fix it?
The text was updated successfully, but these errors were encountered:
TypeScript Version:
1.9.0
Atom-TypeScript plugin Version:
8.11.0
Atom Version:
1.7.4
Code method of Class
As you can see from the comments, the type of a variable is not defined clearly in the callback function.
Why is this happening? How can I fix it?
The text was updated successfully, but these errors were encountered: