我收到此错误:
Property 'Circle' does not exist on type 'typeof Draw'
当我尝试使用时:
var circleDrawer = new L.Draw.Circle();
我认为进口很好:
import 'leaflet-draw';
我错过了什么吗?这是我的package.json文件:
...
"dependencies": {
"@types/proj4leaflet": "^1.0.4",
"leaflet": "1.0.3",
"leaflet-circle-to-polygon": "1.0.0",
"leaflet-draw": "0.4.10",
"leaflet-map": "0.2.1",
"leaflet-measure": "2.1.7",
"leaflet-popup-angular": "^1.0.3",
"leaflet-virtual-grid": "1.0.4",
"leaflet.vectorgrid": "1.2.0",
"proj4leaflet": "^1.0.2",
...
},
"devDependencies": {
"@types/leaflet": "1.0.67",
"@types/leaflet-draw": "0.4.6",
...
}
答案 0 :(得分:1)
请添加此行。
declare const L: any;
我相信你忘了这样做。