type Either2dOr3d = [number, number, number?];
######################################################
setCoordinate(coord: Either2dOr3d) {
const [x, y, z] = coord;
console.log(`Provided coordinates had ${coord.length} dimensions`);
},
####################################################
this.setCoordinate([3,55])
TS: tuple中的可选参数
最新推荐文章于 2024-07-15 20:47:50 发布