Skip to content

Error: Cannot use namespace 'Point' as a type. #1393

@carcigenicate

Description

@carcigenicate

Mapbox GL Version: 3.6.0
Mapbox GL Draw Version: 1.5.0

After upgrading from Mapbox GL 3.4.0 to 3.6.0, I began getting an error that I've been unable to resolve:

Error: node_modules/@types/mapbox__vector-tile/index.d.ts:16:21 - error TS2709: Cannot use namespace 'Point' as a type.

16     loadGeometry(): Point[][];
                       ~~~~~

It's failing internally in the mapbox__vector-tile library that Mapbox imports. This only fails though if Mapbox GL Draw is also included in the project. Otherwise, it works fine.

MCVE:

package.json

{
  "name": "map-mcve",
  "main": "index.js",
  "dependencies": {
    "mapbox-gl": "3.6.0",
    "@mapbox/mapbox-gl-draw": "^1.5.0"
  },
  "devDependencies": {
    "typescript": "^5.8.3"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "esModuleInterop": true,
    "strict": true,
  }
}

And then import mapbox-gl into a index.ts and run tsc.

I was advised to post an issue here, since this might be fixed by an eventual Typescript migration.

I also have a SO question open for more context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    typesIssues related to the TypeScript typings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions