Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are types but this result could not be resolved when respecting package.json "exports" | ts 7016 #2558

Closed
1 task done
a7md0 opened this issue Dec 21, 2023 · 3 comments

Comments

@a7md0
Copy link

a7md0 commented Dec 21, 2023

Staring new project with latest turf & TypeScript (esbuild as bundler) is throwing this error in VSCode

import { polygon } from '@turf/turf';
Could not find a declaration file for module '@turf/turf'. 'node_modules/@turf/turf/dist/es/index.js' implicitly has an 'any' type.
  There are types at '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)
  • The version of Turf you are using, and any other relevant versions.
    • @turf/turf 6.5.0
    • esbuild 0.19.9
    • typescript 5.3.3

tsconfig.json

{
  "compilerOptions": {
    "target": "es2022",
    "strict": true,
    "preserveConstEnums": true,
    "noEmit": true,
    "sourceMap": false,
    "module": "ES2022",
    "moduleResolution": "Bundler",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "isolatedModules": true
  }
}

Related: microsoft/TypeScript#52363

@smallsaucepan
Copy link
Member

Hi @a7md0. This looks like a duplicate of #2414. The way to resolve in that case is to update to one of the Turf alpha releases e.g. 7.0.0-alpha.2

@smallsaucepan smallsaucepan closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2023
@wmonecke
Copy link

@smallsaucepan How can I use types with v7.0.0-alpha.2? I cant seem to import the type Bbox for example.

@smallsaucepan
Copy link
Member

@wmonecke there are a few problems with the exports in 6.5.0. Please take a look at #2394 and if that looks similar to what you are experiencing, we have recently overhauled our exports, which will hopefully address that issue as well. Those changes won't be available until alpha.3 though, with the plan being to release that in coming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants