@types/react-leaflet package and had problems.Definitions by: in index.d.ts) so they can respond.(looks like Author @davschne doesn't exist)
react-leaflet released version 2.0 a few weeks ago. Looks like there were some breaking changes.
Changelog: https://github.com/PaulLeCam/react-leaflet/releases/tag/v2.0.0
Especially LeafletConsumer, LeafletProvider, withLeaflet are missing.
Thank you for your great work!
I most certainly do exist. Reports of my death have been grossly exaggerated.
Yeah, looks like the type defs could use an update. Not sure whether I'll have time to do it. If you'd like to take a stab at updating them, @benneq, I'm happy to review the PR.
Glad you exist :) Really strange. When I created this issue it didn't suggest me your name, while typing @davschne. Now it works as expected.
I've never written d.ts files. Not sure if I have enough time in the next couple days / weeks.
Isn't there any flow -> typescript tool? The flow definitions of the library itself look pretty solid. Though I guess it could(?!) be pretty easy to just let some tool convert it to typescript.
At the moment I'm using something like this as a workaround:
import * as RL from 'react-leaflet';
const ReactLeaflet = RL as any;
ReactLeaflet.withLeaflet(...);
Here is my workaround.
// https://react-leaflet.js.org/docs/en/context.html
import * as L from "leaflet";
import "react-leaflet";
declare module "react-leaflet" {
const withLeaflet: <T>(component: T) => T;
interface LeafletContext {
map?: L.Map;
}
}
To extend on @shincysl's workaround.
https://gist.github.com/gwillz/9498267353770cbd121fe3aabc5cec68
Includes Consumer/Provider, withLeaflet props, and contextValue property for a few types.
Any further updates about having react-leaflet lib v2.0 to be supported by @types/react-leaflet?
Are there any news on this?
Happy new year guys! Any news? :)
Most helpful comment
Any further updates about having react-leaflet lib v2.0 to be supported by
@types/react-leaflet?