visgl / react-map-gl

React friendly API wrapper around MapboxGL JS
http://visgl.github.io/react-map-gl/
Other
7.88k stars 1.35k forks source link

[Bug] Missing MapboxGeoJSONFeature #2264

Closed lightstrike closed 1 year ago

lightstrike commented 1 year ago

Description

When importing MapboxGeoJSONFeature like so:

import type { MapboxGeoJSONFeature, MapLayerMouseEvent, MapRef } from 'react-map-gl';

The following error is thrown:

'"react-map-gl"' has no exported member named 'MapboxGeoJSONFeature'. Did you mean 'MapGeoJSONFeature'?

This type exists in the docs, yet no where else in the codebase. I am trying to use a type that includes the coordinates property for the following:

mapRef?.current?.easeTo({
  center: feature.geometry?.coordinates,
  zoom,
  duration: 500
});

If I try to replace MapboxGeoJSONFeature with MapGeoJSONFeature, the following error is thrown:

Property 'coordinates' does not exist on type 'Geometry'.
Property 'coordinates' does not exist on type 'GeometryCollection<Geometry>'.

Expected Behavior

No response

Steps to Reproduce

  1. Copy clusters example code.
  2. Replace lines 9-10 in app.tsx with import type { MapboxGeoJSONFeature, MapLayerMouseEvent, MapRef } from 'react-map-gl';
  3. Run npm start or view TS import error in code editor.

Environment

Logs

No response

Pessimistress commented 1 year ago

The type is now called MapGeoJSONFeature. There is an open PR that updates the docs.

Pessimistress commented 1 year ago

Backward compatibility is fixed in v7.1.5.