I am having little issue with TypeScript. I have a module, where I have defined two classes (I will provide code below). I cannot access other class, inside the first one, and the opposite. What am I doing wrong?
Here is my code:
module Model {
export class Model {
public apples:Apple[];
getAppleCnt() {
return this.model.apples.length;
}
createApple(){
var index = this.model.apples.getAppleCnt()+1;
return this.model.apples.push(Apple.createApple("Apple "+index,index));
}
createApples(){
this.model = new Model();
this.model.apples.=[];
}
}
export class Apple {
createApple(name:string,index:number){
var apple = new Apple();
apple.name = name;
apple.index = index;
return apple;
}
}
}