Turf.js - Type declarations not found when importing into Vue/Vite project

38 Views Asked by At

I use Turf.js's bbox functionality. No matter what I try, TS type definitions seem not to be found.

I tried the following:

package.json:

"dependencies": {
   ...
    "@turf/turf": "6.5.0",
    "vue": "^3.3.11",
    ...
  },

Import in Vue file (using Composition API and TS):

<script setup lang="ts">

import * as turf from "@turf/turf";
...
</script>

TypeScript error:

Could not find a declaration file for module '@turf/turf'. '/Users/.../node_modules/@turf/turf/dist/es/index.js' implicitly has an 'any' type.
  There are types at '/Users/.../node_modules/@turf/turf/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@turf/turf' library may need to update its package.json or typings.ts(7016)
0

There are 0 best solutions below