There is a puzzling issue with the arrays in my class. Despite creating them, when I try to access them in another class they are not recognized, only the otherProp
is visible. To make matters worse, attempting to add elements to the arrays results in an error because myArray1
or myArray2
is apparently undefined. I have experimented with different ways of initializing the arrays, such as using "any[]" and setting them as empty upon creation, but none of these methods have resolved the issue.
export class MyModel{
myArray1: Array<{dias: Array<number>, amount: number}>
otherProp: number
myArray2: Array<{month: number, amount: number}>
Constructor(){
this.otherProp= 0;
this.myArray1= new Array<{dias: Array<number>, amount: number}>();
this.myArray2 = new Array<{month: number, amount: number}>();
}
}