【发布时间】:2016-09-10 15:53:28
【问题描述】:
我有以下...
export class Puzzle {
pieces : Piece[];
orderedPieces : Piece[][];
constructor(width: number, height: number){
this.height = height, this.width = width;
let total : number = width * height;
this.pieces = new Array<Piece>(total);
this.orderedPieces = new Piece[height][width]; // Doesn't work what do I put here?
}
...
}
如何在 Typescript 中声明这样的内容?
错误是...
无法读取未定义的属性“2”
【问题讨论】:
标签: javascript multidimensional-array typescript