mapbox / mapbox/mapbox-sdk-js

ReferenceError: MapboxGeocoder is not defined

Open
#436 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
768
Forks
191
PR merge metrics
No merged PRs in 30d

Description

React/NextJS

In my component, I start by trying to import

`import mbxGeocoding from '@mapbox/mapbox-sdk/services/geocoding';`

and the linter tells me

> Could not find a declaration file for module '@mapbox/mapbox-sdk/services/geocoding'.

Where am I going wrong?

package.json
```
"dependencies": {
"@dnd-kit/core": "^5.0.3",
"@dnd-kit/sortable": "^6.0.1",
"@dnd-kit/utilities": "^3.1.0",
"@mapbox/mapbox-sdk": "^0.12.1",
"axios": "^0.26.1",
"daisyui": "^2.13.4",
"date-fns": "^2.28.0",
"firebase": "^9.6.4",
"mapbox-gl": "^2.8.2",
"next": "^12.1.2",
"nookies": "^2.5.2",
"react": "17.0.2",
"react-data-table-component": "^7.4.7",
"react-datepicker": "^4.6.0",
"react-dom": "^17.0.2",
"react-firebase-hooks": "^5.0.3",
"react-geolocated": "^3.2.0",
"react-hook-form": "^7.28.1",
"react-hot-toast": "^2.2.0",
"react-markdown": "^8.0.0",
"react-scripts": "^5.0.1",
"react-select": "^5.2.2",
"styled-components": "^5.3.5",
"use-reducer-async": "^2.1.0"
},
"devDependencies": {
"@svgr/webpack": "^6.2.1",
"autoprefixer": "^10.4.2",
"eslint": "8.12.0",
"eslint-config-next": "^12.0.1",
"eslint-plugin-react-hooks": "^4.4.0",
"postcss": "^8.4.5",
"tailwind-watch": "^0.0.6",
"tailwindcss": "^3.0.15",
"tailwindcss-debug-screens": "^2.2.1"
}
}
```

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 reproducing the linter error from the package.json dependencies and the import of @mapbox/mapbox-sdk/services/geocoding. Inspect how that package exposes its geocoding service and whether declaration files are present; done means the reported import no longer produces the missing-declaration error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, react, typescript
Domain
api, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.