beyonk-group / svelte-mapbox

MapBox Map and Autocomplete components for Svelte (or Vanilla JS)
MIT License
345 stars 61 forks source link

Could not find a declaration file for module '@beyonk/svelte-mapbox'. #71

Closed pjarnfelt closed 1 year ago

pjarnfelt commented 2 years ago

When using SvelteKit, then this eslinting error is shown.

Could not find a declaration file for module '@beyonk/svelte-mapbox'. '/node_modules/@beyonk/svelte-mapbox/src/lib/components.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/beyonk__svelte-mapbox` if it exists or add a new declaration (.d.ts) file containing `declare module '@beyonk/svelte-mapbox';`ts(7016)

npm i --save-dev @types/beyonk__svelte-mapbox

does not help as there are no types defined in https://registry.npmjs.org/@types%2fbeyonk__svelte-mapbox

adam21xc commented 1 year ago

I am facing a similar issue as well. I am able to get this code to work in the Svelte Repl but not within my own Sveltekit project. I am receiving the same error as above even after creating my Sveltekit project with no typescript.

<script>
    import { Map, Marker } from '@beyonk/svelte-mapbox'
    let mapComponent

    function onReady() {
    mapComponent.flyTo({center:[-80.1527281,39.7660152]}) 
    }
</script>

  <Map accessToken=""
      style="mapbox://styles/mapbox/outdoors-v11"
    bind:this={mapComponent} 
    on:ready={onReady}
  >
       <Marker lng=-80.1527281 lat=39.7660152 label="NYC" />
  </Map>
matteopolak commented 1 year ago

I fixed this issue by importing @beyonk/svelte-mapbox/components instead.

e.g.

import { Map, Marker } from '@beyonk/svelte-mapbox/components';