You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The expected function type for the externalGeocoder property in the MapboxGeocoder.GeocoderOptions interface is not accurate. The documentation states the expected function signature as: (property) MapboxGeocoder.GeocoderOptions.externalGeocoder?: ((searchInput: string, features: GeoJSON.FeatureCollection<GeoJSON.Geometry>) => Promise<GeoJSON.FeatureCollection>) | undefined
This suggests that the function should return a Promise<GeoJSON.FeatureCollection>. However, in practice, the function is expected to return an Array<GeoJSON.Feature<GeoJSON.Geometry>> instead of a GeoJSON.FeatureCollection.
Actual Behavior:
When I write a function that returns a GeoJSON.FeatureCollection as described in the documentation, the Mapbox Geocoder doesn't work correctly. But if I modify the function to return an Array<GeoJSON.Feature<GeoJSON.Geometry>>, the Mapbox Geocoder works as expected.
Expected Behavior:
The documentation and type definition for the externalGeocoder property should be updated to reflect the correct expected return type, which is an Array<GeoJSON.Feature<GeoJSON.Geometry>> instead of a GeoJSON.FeatureCollection.
Proposed Resolution:
Update the type definition for the externalGeocoder property in the MapboxGeocoder.GeocoderOptions interface to the following: (property) MapboxGeocoder.GeocoderOptions.externalGeocoder?: ((searchInput: string, features: GeoJSON.FeatureCollection<GeoJSON.Geometry>) => Promise<Array<GeoJSON.Feature<GeoJSON.Geometry>>>) | undefined
This will ensure the type definition accurately reflects the actual expected return type for the externalGeocoder function.
The text was updated successfully, but these errors were encountered:
Discussed in #71080
Originally posted by borntobesso November 4, 2024
Issue Summary:
The expected function type for the externalGeocoder property in the MapboxGeocoder.GeocoderOptions interface is not accurate. The documentation states the expected function signature as:
(property) MapboxGeocoder.GeocoderOptions.externalGeocoder?: ((searchInput: string, features: GeoJSON.FeatureCollection<GeoJSON.Geometry>) => Promise<GeoJSON.FeatureCollection>) | undefined
This suggests that the function should return a Promise<GeoJSON.FeatureCollection>. However, in practice, the function is expected to return an Array<GeoJSON.Feature<GeoJSON.Geometry>> instead of a GeoJSON.FeatureCollection.
Actual Behavior:
When I write a function that returns a GeoJSON.FeatureCollection as described in the documentation, the Mapbox Geocoder doesn't work correctly. But if I modify the function to return an Array<GeoJSON.Feature<GeoJSON.Geometry>>, the Mapbox Geocoder works as expected.
Expected Behavior:
The documentation and type definition for the externalGeocoder property should be updated to reflect the correct expected return type, which is an Array<GeoJSON.Feature<GeoJSON.Geometry>> instead of a GeoJSON.FeatureCollection.
Proposed Resolution:
Update the type definition for the externalGeocoder property in the MapboxGeocoder.GeocoderOptions interface to the following:
(property) MapboxGeocoder.GeocoderOptions.externalGeocoder?: ((searchInput: string, features: GeoJSON.FeatureCollection<GeoJSON.Geometry>) => Promise<Array<GeoJSON.Feature<GeoJSON.Geometry>>>) | undefined
This will ensure the type definition accurately reflects the actual expected return type for the externalGeocoder function.
The text was updated successfully, but these errors were encountered: