Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure features property is typed as MapGeoJSONFeature[] on MapLayerMouseEvent and MapLayerTouchEvent. #2244

Merged

Conversation

parkerziegler
Copy link
Contributor

Currently, MapLayerMouseEvent and MapLayerTouchEvent are typed with their features property as GeoJSON.Feature[]. However, the features returned on either of these events are MapGeoJSONFeatures; they contain the additional properties of that interface (e.g., layer, source, sourceLayer, and state). In addition, it appears the unit tests already cast features returned on MapLayerMouseEvents to MapGeoJSONFeature[]; see here for an example. This PR just corrects the types!

Looking through the CHANGELOG, it appears MapGeoJSONFeature is a fairly new addition (2.1.8-pre.2), so I think this may just be on spot where the types got missed!

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Document any changes to public APIs.
    • While these types are part of the TypeScript public API, they are not core to the library API (nor currently documented on the docs site).
  • Add an entry to CHANGELOG.md under the ## main section.

@HarelM
Copy link
Collaborator

HarelM commented Mar 3, 2023

Thanks for taking the time to fix this!
The migration from flow to typescript contained a lot of changes, so it makes sense this was missed.

@HarelM HarelM merged commit bc6d6f4 into maplibre:main Mar 3, 2023
@parkerziegler parkerziegler deleted the fix/features-type-on-map-layer-events branch March 3, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants