Skip to content

[Bug] TypeScript error when using MapboxOverlay with "react-map-gl/maplibre" #9211

Closed
@josh-taylor

Description

@josh-taylor

Description

I am getting the following error from TypeScript when using useControl from react-map-gl/maplibre and MapboxOverlay when following the documentation.

Type 'MapboxOverlay' does not satisfy the constraint 'IControl<MapInstance>'.
  Types of property 'onAdd' are incompatible.
    Type '(map: Map$1) => HTMLDivElement' is not assignable to type '(map: MapInstance) => HTMLElement'.
      Types of parameters 'map' and 'map' are incompatible.
        Type 'MapInstance' is missing the following properties from type 'Map$1': style, painter, _container, _missingCSSCanary, and 245 more.ts(2344)

(I spotted that somebody else has a similar issue in #8250 (comment))

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CartoLayer
  • ArcGIS

Expected Behavior

No TypeScript error when using useControl with the MapboxOverlay. Or maybe we need something like MaplibreOverlay?

Steps to Reproduce

Build the example that is in the documenation.

Environment

  • Framework version: 9.0.33
  • Browser: N/A
  • OS: macOS 14.6.1

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions