// Any set of three numbers
type MatrixRow = [number, number, number];
// Any set of three rows
type Matrix = [MatrixRow, MatrixRow, MatrixRow];
const exampleA: Matrix[] = [
[
[0,0,0],
[1,1,1],
[0,0,0],
], [
[0,1,0],
[0,1,0],
[0,1,0],
]
];
const exampleB: Matrix[] = [];
您还可以为外部数组创建一个类型:
// A list of matrices
type MatrixSet = Matrix[];
const exampleC: MatrixSet = [];
1条答案
按热度按时间qni6mghb1#
为了清楚起见,您可以将内部类型标记为:
您还可以为外部数组创建一个类型:
TypeScriptPlayground