From 81484789b5c01435d4354657dde394305510e102 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Mon, 16 Sep 2024 11:27:38 +0200 Subject: [PATCH] import geojson types explicitly --- gpx/src/gpx.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gpx/src/gpx.ts b/gpx/src/gpx.ts index 1191a804..caf5cd59 100644 --- a/gpx/src/gpx.ts +++ b/gpx/src/gpx.ts @@ -1,6 +1,7 @@ import { ramerDouglasPeucker } from "./simplify"; import { Coordinates, GPXFileAttributes, GPXFileType, LineStyleExtension, Link, Metadata, RouteType, TrackExtensions, TrackPointExtensions, TrackPointType, TrackSegmentType, TrackType, WaypointType } from "./types"; import { immerable, isDraft, original, freeze } from "immer"; +import { Feature, FeatureCollection } from "geojson"; function cloneJSON(obj: T): T { if (obj === null || typeof obj !== 'object') { @@ -23,7 +24,7 @@ export abstract class GPXTreeElement> { abstract getSegments(): TrackSegment[]; abstract getTrackPoints(): TrackPoint[]; - abstract toGeoJSON(): GeoJSON.Feature | GeoJSON.Feature[] | GeoJSON.FeatureCollection | GeoJSON.FeatureCollection[]; + abstract toGeoJSON(): Feature | Feature[] | FeatureCollection | FeatureCollection[]; // Producers abstract _reverse(originalNextTimestamp?: Date, newPreviousTimestamp?: Date); @@ -218,7 +219,7 @@ export class GPXFile extends GPXTreeNode { }); } - toGeoJSON(): GeoJSON.FeatureCollection { + toGeoJSON(): FeatureCollection { return { type: "FeatureCollection", features: this.children.flatMap((child) => child.toGeoJSON()) @@ -518,7 +519,7 @@ export class Track extends GPXTreeNode { return undefined; } - toGeoJSON(): GeoJSON.Feature[] { + toGeoJSON(): Feature[] { return this.children.map((child) => { let geoJSON = child.toGeoJSON(); if (this.extensions && this.extensions['gpx_style:line']) { @@ -879,7 +880,7 @@ export class TrackSegment extends GPXTreeLeaf { return this.trkpt; } - toGeoJSON(): GeoJSON.Feature { + toGeoJSON(): Feature { return { type: "Feature", geometry: {