I am testing Typescript and I ran into troubles with Array, interface and nullable variable :
I have this interface :
interface Entity {
life: number;
type: EntityType;
}
And I have this property :
world: Entity[];
I am trying to initialize with :
this.world = [
[null, null, null, null, null, null, null, null],
[null, null, null, null, null, null, null, null],
[null, null, null, null, null, null, null, null],
[null, null, null, null, null, null, null, null],
[null, null, null, null, null, null, null, null],
[null, null, null, null, null, null, null, null],
[null, null, null, null, null, null, null, null],
[null, null, null, null, null, null, null, null]
];
The compiler told me :
Cannot convert {}[] to Entity[]
Is this possible ? Am I doing something wrong.
Thanks in advance !
PS : Sorry for my english, I am not a native speaker.