My situation involves an interface:
interface IGroup{
groupNumber:number;
groupMembers:Array<ISeatPlanGroup>;
totalStudentNumber:number;
}
Every time I attempt to assign a value to the groupNumber property, the compiler throws an error saying that the property cannot be set on undefined.
var group: IGroup;
group.groupNumber = groupArr[i].groupNo;
group.groupMembers=[];
group.groupMembers.push(groupArr[i]);
group.totalStudentNumber = 0;
group.totalStudentNumber+=groupArr[i].studentNumber;
I also attempted to initialize it with:
group.groupNumber = 0;
But the error persists. How can this issue be resolved?