-
Notifications
You must be signed in to change notification settings - Fork 156
Description
Hai, im trying to use react-leaflet-draw version 0.20.4 with typescript, but im having some difficulty getting things to work. I'm wondering if you have any suggestions, and if these issues are known.
Dependencies
So im working with these packages:
"@types/leaflet": "^1.9.8",
"@types/leaflet-draw": "^1.0.11",
"leaflet": "^1.9.4",
"leaflet-draw": "^1.0.4",
"react-leaflet": "^4.2.1",
"react-leaflet-draw": "^0.20.4",
Errors
So im receiving typescript errors for node_modules/react-leaflet-draw/src/index.d.ts. Depending on which types dependencies i use, i get different errors:
When using the types for leaflet and leaflet-draw
"@types/leaflet": "^1.9.16",
"@types/leaflet-draw": "^1.0.11",
I get this error message node_modules/react-leaflet-draw/src/index.d.ts:25:9 - error TS2709: Cannot use namespace 'EditOptions' as a type.
With just the leaflet type
"@types/leaflet": "^1.9.16",
I get these error messages
node_modules/react-leaflet-draw/src/index.d.ts:3:2 - error TS2305: Module '"leaflet"' has no exported member 'DrawOptions'.
node_modules/react-leaflet-draw/src/index.d.ts:4:2 - error TS2724: '"leaflet"' has no exported member named 'EditOptions'. Did you mean 'setOptions'?
node_modules/react-leaflet-draw/src/index.d.ts:6:2 - error TS2305: Module '"leaflet"' has no exported member 'DrawEvents'.
Tried solutions
-
So i've tried pinning @types/leaflet to the version you use
1.7.11, but this just results into the previous error messages + a couple extra.. -
Setting
"skipLibCheck": truein my tsconfig.json does solve it, but i really want to avoid doing this (as it feels a bit to aggressive)