mapbox / mapbox/mapbox-gl-geocoder

mapbox-gl-geocoder not compatible with mapbox-gl@3.5.1

Open
#528 8 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug
Dominant language
JavaScript
Stars
388
Forks
181
PR merge metrics
No merged PRs in 30d

Description

I'm migrating my project to mapbox-gl 3.5.1 but have hit a blocker

"dependencies": { "@mapbox/mapbox-gl-geocoder": "^5.0.2", "mapbox-gl": "^3.5.1", ... }, "devDependencies": { "@types/mapbox__mapbox-gl-geocoder": "^5.0.0", // I've tried building my project with this typing included as well as excluded }

When included, I get many errors. Here's 2 examples:

Example 1:
Error: node_modules/mapbox-gl/dist/mapbox-gl.d.ts:8293:2 - error TS2416: Property 'tileID' in type 'ImageSource' is not assignable to the same property in base type 'ISource'.
Type 'CanonicalTileID | null | undefined' is not assignable to type 'CanonicalTileID | undefined'.
Type 'null' is not assignable to type 'CanonicalTileID | undefined'.

8293 tileID: CanonicalTileID | null | undefined;

Example 2:
Error: node_modules/@types/mapbox__mapbox-gl-geocoder/index.d.ts:270:40 - error TS2694: Namespace '"C:/Users/.../app/node_modules/mapbox-gl/dist/mapbox-gl"' has no exported member 'FlyToOptions'.

270 setFlyTo(flyTo: boolean | mapboxgl.FlyToOptions | mapboxgl.FitBoundsOptions): this;

When excluded, I get many different errors. Here are examples:

Example 1:
Could not find a declaration file for module '@mapbox/mapbox-gl-geocoder'. 'c:/Users/.../app/node_modules/@mapbox/mapbox-gl-geocoder/lib/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/mapbox__mapbox-gl-geocoder if it exists or add a new declaration (.d.ts) file containing declare module '@mapbox/mapbox-gl-geocoder';ts(7016)

Example 2:
Error: src/app/services/map/layers/conditions.service.ts:238:133 - error TS2503: Cannot find namespace 'GeoJSON'.

238 private _getClosestFeature(point: LngLat, features: (GeoJSON.Feature & { geometry: { coordinates: [ number, number ][] } })[]): GeoJSON.Feature & { geometry: { coordinates: [ number, number ][] } } {

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the package entry point at lib/index.js and the referenced @types/mapbox__mapbox-gl-geocoder declarations, then reproduce the reported errors with mapbox-gl 3.5.1 and TypeScript. Done means the geocoder and its typings can be consumed with that version without the reported declaration or namespace errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.