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

Broken TS types #2598

Open
apjoseph opened this issue Apr 15, 2024 · 4 comments
Open

Broken TS types #2598

apjoseph opened this issue Apr 15, 2024 · 4 comments

Comments

@apjoseph
Copy link

Typescript types for 6.5.0 across various @turf/*packages are broken due to implicit any:

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

tsconfig.json

{
 "compilerOptions": {
   "target": "esNext",
   "lib": [
     "dom",
     "dom.iterable",
     "esNext"
   ],
   "allowJs": false,
   "skipLibCheck": false,
   "strict": true,
   "forceConsistentCasingInFileNames": true,
   "noEmit": true,
   "esModuleInterop": true,
   "module": "esNext",
   "moduleResolution": "bundler",
   "resolveJsonModule": true,
   "isolatedModules": true,
   "incremental": true,
   "plugins": [
     {
       "name": "next"
     }
   ],
   "strictNullChecks": true,
   "jsx": "preserve"
 },
 "include": [
   "next-env.d.ts",
   "*.ts",
   "*.tsx",
   "src/**/*.ts",
   "src/**/*.tsx",
   ".next/types/**/*.ts"
 ],
 "exclude": [
   ".next",
   "node_modules"
 ]
}

@twelch
Copy link
Collaborator

twelch commented Apr 16, 2024

This should be resolved in the 7.0 prerelease in npm. Please try that if you can and report back. A fix for this is not expected to be released for 6.x This is an often filed issue (#2592, #2587, #2586) so let's leave it open until a stable 7.0 release is done. Unsure on the ETA for that.

@pm0u
Copy link

pm0u commented Apr 24, 2024

confirmed fixed for me on 7.0.0-alpha.115

@AeroSpace97
Copy link

AeroSpace97 commented Apr 30, 2024

Temporary local workaround

add "@turf/*": ["./node_modules/@turf/*/dist/js/index.d.ts"] to compilerOptions.paths

{
  "compilerOptions": {
    "paths": {
      "@turf/helpers": ["./node_modules/@turf/helpers/dist/js/index.d.ts"]
    }
  }
}

@BenJackGill
Copy link

Confirming that I had the same issue and the latest 7.0.0-alpha.116 fixed it for me.

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

No branches or pull requests

6 participants