[Bug] Type `MapLayerMouseEvent` for `onClick` on `<Map>` does not match data
tordans opened this issue · 1 comments
tordans commented
Description
The type I get in VS Code is (property) features?: Feature<Geometry, GeoJsonProperties>[] | undefined
(I include Map
from react-map-gl/maplibre
.)
However, the generic GeoJsonProperties
is not quite right, it does not type the special properties like source
.
I don't understand where this information is lost …
- The docs are right https://github.com/visgl/react-map-gl/blob/master/docs/api-reference/types.md?plain=1#L153-L160
- They match what Maplibre documents https://maplibre.org/maplibre-gl-js/docs/API/types/maplibregl.MapGeoJSONFeature/
- The code exports the types from Maplibre
react-map-gl/src/types/events-maplibre.ts
Line 35 in e11b41e
- And Maplibre is explicit that
features
areMapGeoJSONFeature
https://github.com/maplibre/maplibre-gl-js/blob/572d6071fd5fce9f71bdb267f05532616e8d7be0/src/ui/events.ts#L17C66-L17C66 andMapGeoJSONFeature
has all the data/types we expect https://github.com/maplibre/maplibre-gl-js/blob/main/src/util/vectortile_to_geojson.ts#L18C1-L23
Expected Behavior
The react map gl types should match the Maplibre types.
Steps to Reproduce
Environment
- Framework version: "react-map-gl": "7.1.6",
- Map library: "maplibre-gl": "^2.4.0",
Logs
No response
tordans commented
I am using "react-map-gl": "7.1.7"
ATM and this issue is not present anymore. => Closing