React-leaflet: Nothing is working with typescript

Created on 2 Nov 2020  路  6Comments  路  Source: PaulLeCam/react-leaflet

Hi I'm new with react-leaflet, I'm working on typescript and everything I tried seems to fail, the documentation is not clear about working with typescript, despite of the fact that the library seems to be coded in ts. I'll apreciate if someone could help me to get it working with typescript. Tnx in advance!

Most helpful comment

Yes I added a section to the installation docs: https://react-leaflet.js.org/docs/start-installation#using-typescript

All 6 comments

image
image

Same here

React Leaflet provides type definitions directly in the installed package but Leaflet does not, you need to install them as needed: yarn add -D @types/leaflet.

Sorry, another question, how can I define event hendlers on the components?

eg:
image

React Leaflet provides type definitions directly in the installed package but Leaflet does not, you need to install them as needed: yarn add -D @types/leaflet.

Tnx @PaulLeCam it worked!

It might be worth adding some clarification in the documentation on installing with typescript. I would add a PR to the readme but the documentation is separate. Greetings from Argentina and thanks for the quick response!

Yes I added a section to the installation docs: https://react-leaflet.js.org/docs/start-installation#using-typescript

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrafei picture mrafei  路  4Comments

fborghi picture fborghi  路  3Comments

farahabdi picture farahabdi  路  3Comments

gane5h picture gane5h  路  3Comments

ekatzenstein picture ekatzenstein  路  4Comments