declare module 'geojson' {
  type Position = number[];

  interface GeoJsonObject {
    readonly type: string;
    readonly bbox?: number[];
  }

  interface Geometry extends GeoJsonObject {
    readonly type:
      | 'Point'
      | 'MultiPoint'
      | 'LineString'
      | 'MultiLineString'
      | 'Polygon'
      | 'MultiPolygon'
      | 'GeometryCollection';
    readonly coordinates: any;
    readonly geometries?: Geometry[];
  }

  interface Feature<G extends Geometry = Geometry, P = Record<string, any>> extends GeoJsonObject {
    rsmKey: Key | null | undefined;
    readonly type: 'Feature';
    readonly geometry: G | null;
    readonly properties: P | null;
    readonly id?: string | number;
  }

  interface FeatureCollection<G extends Geometry = Geometry, P = Record<string, any>> extends GeoJsonObject {
    readonly type: 'FeatureCollection';
    readonly features: Array<Feature<G, P>>;
  }

  export type { Position, GeoJsonObject, Geometry, Feature, FeatureCollection };
}
