A question about Leaflet plugin for printing the map: https://github.com/Igor-Vladyka/leaflet.browser.print

I am curious if it is supposed to work in React + TypeScript? After the package is installed. I am trying to do an import

import "leaflet.browser.print/dist/leaflet.browser.print"

and I have a compile error: Module Not Found. but it is really in node_modules by this address. Is there anything specific that has to be done to use this library with React + TS?

If I just install the package without any import and write

var browserControl = L.control.browserPrint({position: 'topLeft'}).addTo(instance)

it also won't work TypeError: leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.control.browserPrint is not a function if I suppress with @ts-ignore. Otherwise TS will tell me "Property 'browserPrint' doesn't exist on type 'typeof Control'

How to import this plugin with React + TS?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.