【发布时间】:2022-01-21 17:56:38
【问题描述】:
打字稿显示此错误:
Source has 5 element(s) but target allows only 0
Test.ts
await Map.createPoint("New York",[[323, 232],
[123, 233],
[221, 455],
[321, 212],
[122, 253]]);
地图.ts
class Map{
async createGeofencesTest(city:string,points:[]): Promise<void> {
await Admin.setGeofenceCity(city);
await Admin.Points(points);
return;
}
}
我做错了什么?
【问题讨论】:
-
points:[] -
@[] - 类型数组
-
[]是一个包含 0 个元素的数组。你的意思是number[][]还是[number, number][]?
标签: javascript arrays typescript testing types