Property 'Draw' does not exist on type 'typeof Control' Property 'Draw' does not exist on type 'typeof Control' typescript typescript

Property 'Draw' does not exist on type 'typeof Control'


I solved the issue by importing leaflet-draw

import 'leaflet-draw';

Not sure why it wasn't import by tsconfig, but yay it works!


Thanks @aclokay for the insight. I'd complete this answer by adding that you musn't forget to change the standard leaflet import as well. For example :

// import * as L from 'leaflet';  // --> Doesn't work : Property 'Draw' does not exist on type 'typeof Control'.declare const L: any; // --> Worksimport 'leaflet-draw';export function drawPlugin(map: any) {  const drawnItems = L.featureGroup().addTo(map);  const drawControl = new L.Control.Draw({    edit: {      featureGroup: drawnItems,    },    draw: {      polygon: false,      polyline: false,      marker: false,      circlemarker: false    }  });  map.addControl(drawControl);  map.on(L.Draw.Event.CREATED, function (event) {    const layer = event.layer;    drawnItems.addLayer(layer);  });}