In my code, I have two global variables defined as
constructor() {
this.map = new Map();
this.player = new Player([], \"\");
}
Your this is most likely referring to another object depending on how handleInput is being called. In your contructor(), either bind handleInput to this or change your handleInput to use arrow function:
constructor() {
this.handleInput = this.handleInput.bind(this);
}
Or:
handleInput = (cmd:Command, arg:string):boolean => {}