mapbox-gl-js version
v3.25.0
Browser and version
Chrome Version 149.0.7827.200
Expected behavior
After switching the ESM entry point to named exports (import * as mapboxgl from 'mapbox-gl/esm'), binding the Map object to the MapboxSearchBox object should be possible.
Actual behavior
After creating the map object using the new ESM entry point, trying to bind the map to the search box throws a type error:
import * as mapboxgl from 'mapbox-gl/esm';
...
this.map = new mapboxgl.Map;
...
const searchBox = new MapboxSearchBox();
searchBox.bindMap(this._map!);
Argument of type 'import("/node_modules/mapbox-gl/dist/esm/mapbox-gl").Map' is not assignable to parameter of type 'mapboxgl.Map'.
Excessive stack depth comparing types 'Map$1' and 'Map$1'.
The source of the issue is the mapboxgl import path in the MapboxSearchBox component @mapbox/search-js-web/dist/components/MapboxSearchBox.d.ts which is still using the legacy path (import mapboxgl from 'mapbox-gl';).
The workaround is to cast the map instance as any, but an update to the search-js-web is needed to reflect the new import path.
searchBox.bindMap(this._map! as any);
Link to the demonstration
No response
Steps to trigger the unexpected behavior
No response
Relevant log output
mapbox-gl-js version
v3.25.0
Browser and version
Chrome Version 149.0.7827.200
Expected behavior
After switching the ESM entry point to named exports (
import * as mapboxgl from 'mapbox-gl/esm'), binding the Map object to the MapboxSearchBox object should be possible.Actual behavior
After creating the map object using the new ESM entry point, trying to bind the map to the search box throws a type error:
The source of the issue is the
mapboxglimport path in theMapboxSearchBoxcomponent @mapbox/search-js-web/dist/components/MapboxSearchBox.d.ts which is still using the legacy path (import mapboxgl from 'mapbox-gl';).The workaround is to cast the map instance as
any, but an update to thesearch-js-webis needed to reflect the new import path.Link to the demonstration
No response
Steps to trigger the unexpected behavior
No response
Relevant log output