Hey, I've got an interesting situation with my Typescript interface:
interface sprite_loading {
[index: number]: {
URL: string,
name: string
}}
So, within the class, I'm creating an array like this:
public spriteLoading: sprite_loading;
However, when I attempt to iterate through this array using forEach:
private preload() {
var phaser = this;
this.spriteLoading.forEach(function (element) { //this is where things get tricky
phaser.game.load.image(element.name, element.URL);
});
}
Although the code functions correctly, I encounter this error message:
engine.ts:57:28 - error TS2339: Property 'forEach' does not exist on type 'sprite_loading'.
Can you believe it? Why am I getting this error if spriteLoading is indeed supposed to be an array?