Skip to content

work with React + TypeScript #116

@KonstantinBiryukov

Description

@KonstantinBiryukov

I am curious if it is supposed to work in React + TypeScript?
After the package is installed. I am trying to do import
import "leaflet.browser.print/dist/leaflet.browser.print"
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), where instance is a Map object
it doesn't work. I have an error: Property 'browserPrint' does not exist on type 'typeof control'. TS2339

And if I suppress this error, I have TypeError: Cannot read properties of undefined (reading 'Mode')
How to extend this L.control class by the plugin and use it in React + TS?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions