Skip to content

[Bug] Non-standard FeatureCollection type in editable-layers #202

Open
@charlieforward9

Description

@charlieforward9

Module

  • deck.gl-community/arrow-layers
  • deck.gl-community/bing-maps
  • deck.gl-community/editable-layers
  • deck.gl-community/experimental
  • deck.gl-community/graph-layers
  • deck.gl-community/layers
  • deck.gl-community/react
  • deck.gl-community/react-graph-layer

Description

The FeatureCollection type in the editable-types does not conform to the standard GeoJSON.FeatureCollection type provided by the GeoJSON namespace.

Expected Behavior

It feels appropriate to use the GeoJSON namespace instead of redefinining the types

I am willing to contribute to this with some guidance and discussion on the correct approach.

Steps to Reproduce

 const [feature, setFeatures] = useState<GeoJSON.FeatureCollection>({
    type: "FeatureCollection",
    features: [],
  });
  const layer = new EditableGeoJsonLayer({
    id: "geojson-layer",
    data: feature, // ts error: see below 
    mode,
    selectedFeatureIndexes: [],

    onEdit: ({ updatedData }) => {
      setFeatures(updatedData);
    },
  });
Type 'FeatureCollection<Geometry, GeoJsonProperties>' is not assignable to type 'FeatureCollection'.
  Types of property 'features' are incompatible.
    Type 'Feature<Geometry, GeoJsonProperties>[]' is not assignable to type 'Feature[]'.
      Type 'Feature<Geometry, GeoJsonProperties>' is not assignable to type 'Feature'.
        Type 'Feature<Geometry, GeoJsonProperties>' is not assignable to type 'FeatureOf<MultiPolygon>'.
          Types of property 'geometry' are incompatible.
            Type 'Geometry' is not assignable to type 'MultiPolygon'.
              Type 'Polygon' is not assignable to type 'MultiPolygon'.
                Types of property 'type' are incompatible.
                  Type '"Polygon"' is not assignable to type '"MultiPolygon"'.

Environment

  • Framework version: 9.0.3
  • Browser: Chrome
  • OS: Mac

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions