Skip to content

TypeScript build error in v7.3.2+: Module '"kdbush"' has no exported member 'KDBush' #3018

@juliuszaromskis

Description

@juliuszaromskis

Description

A regression was introduced in @turf/turf version 7.3.2 (persisting in 7.3.3) that prevents TypeScript projects from compiling. The issue stems from the transitive dependency kdbush.


Error Message

node_modules/@types/geokdbush/index.d.ts:1:10 - error TS2614: Module '"kdbush"' has no exported member 'KDBush'. Did you mean to use 'import KDBush from "kdbush"' instead?

1 import { KDBush } from "kdbush";

Minimal Reproduction

Run these commands in a new, empty directory to reproduce the failure:

# 1. Setup project and install the failing version
npm init -y
npm install typescript @turf/turf@7.3.3

# 2. Create a minimal tsconfig.json to isolate the build environment
cat <<EOF > tsconfig.json
{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "skipLibCheck": false,
    "strict": true
  },
  "include": ["index.ts"]
}
EOF

# 3. Create a dummy file that imports Turf
echo "import { pointsWithinPolygon } from '@turf/turf'; console.log('repro');" > index.ts

# 4. Attempt to compile
npx tsc --noEmit

Expected Behavior
The project should compile successfully (0 errors).

Actual Behavior
The compiler fails with the KDBush named export error.

Verification of Regression: If you run npm install @turf/turf@7.3.1 in the same directory and re-run npx tsc --noEmit, the error disappears.

Environment

Turf Version: 7.3.3

Node Version: v24.4.1

TypeScript Version: 5.9.3

OS: macOS

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions