question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript errors in turf 6 (TS2304 and TS2312)

See original GitHub issue

I’ve updated @turf/turf from 5.1.6 to 6.3.0 and now TypeScript is complaining about the following when I transpile my project:

node_modules/@turf/center-median/dist/js/index.d.ts:59:29 - error TS2304: Cannot find name 'Position'.

59     medianCandidates: Array<Position>;
                               ~~~~~~~~

node_modules/@turf/clusters-dbscan/dist/js/index.d.ts:3:38 - error TS2312: An interface can only extend an object type or intersection of object types with statically known members.

3 export interface DbscanProps extends Properties {
                                       ~~~~~~~~~~

node_modules/@turf/clusters-kmeans/dist/js/index.d.ts:2:38 - error TS2312: An interface can only extend an object type or intersection of object types with statically known members.

2 export interface KmeansProps extends Properties {
                                       ~~~~~~~~~~

My tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "esModuleInterop": true,
    "allowJs": false,
    "allowSyntheticDefaultImports": true,
    "target": "es2019",
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "moduleResolution": "node",
    "preserveSymlinks": true,
    "sourceMap": true,
    "outDir": "dist",
    "baseUrl": ".",
    "paths": {
      "*": [
        "node_modules/*",
        "src/types/*",
      ]
    },
    "typeRoots": [
      "./node_modules/@types",
      "./src/types"
    ]
  },
  "include": [
    "src/**/*",
    "test/**/*"
  ]
}

I just tried with 6.2.0 and that gives the same issue. For now, I’ve reverted back to 5.1.6

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mfedderlycommented, Jan 22, 2021

Your typescript settings are likely more strict than Turf’s. I’m hoping to enable all the strictness but in the meantime you might want to look into the skipLibCheck option.

https://www.typescriptlang.org/docs/handbook/compiler-options.html

1reaction
Seairthcommented, Feb 24, 2021

Submitted PR (#2044).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error TS2304: Cannot find name 'Buffer' - Stack Overflow
Following code working fine in JavaScript. When I am writing same thing in TypeScript and compiling, I am getting Buffer is not find...
Read more >
TypeScript errors and how to fix them
Common Errors​​ Below you find a list of common TypeScript errors along with the buggy code and its fixed version.
Read more >
Resolve TypeScript TS2304 compilation errors in Visual Studio
I have recently updated my angular2 project and fell into this TS2304 error in Visual Studio 2015 Error TS2304 Build:Cannot find name ...
Read more >
TypeScript error TS2304 cannot find name require - Edureka
The error that I'm getting is the "TS2304: Cannot find name 'require' " when I attempt to transpile a simple TypeScript Node.js page....
Read more >
[VS 2022] Javascript Content Files Project errors when using ...
I have installed dotnet 6.0.100 using Visual Studio 2022. Ran the commands to upgrade from angular 12 to angular 13 (which has a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found