From a53dc1193bf17ed5e6d7b4ad6f1f7a1cc6e1feb8 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 16 Feb 2026 20:33:48 +0200 Subject: [PATCH] chore(collections/map): fix type issue --- apps/client/src/widgets/collections/geomap/Markers.tsx | 4 ++-- .../client/src/widgets/collections/geomap/Tooltips.tsx | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/client/src/widgets/collections/geomap/Markers.tsx b/apps/client/src/widgets/collections/geomap/Markers.tsx index 33192d0e7c..6d6e1fd1e1 100644 --- a/apps/client/src/widgets/collections/geomap/Markers.tsx +++ b/apps/client/src/widgets/collections/geomap/Markers.tsx @@ -1,4 +1,4 @@ -import { GeoJSONSource } from "maplibre-gl"; +import { type GeoJSONSource } from "maplibre-gl"; import { useCallback, useContext, useEffect } from "preact/hooks"; import FNote from "../../../entities/fnote"; @@ -63,7 +63,7 @@ export default function Markers({ note }: { note: FNote }) { return key; } - const features: maplibregl.GeoJSONFeature[] = []; + const features: GeoJSON.Feature[] = []; for (const childNote of childNotes) { const location = childNote.getLabelValue(LOCATION_ATTRIBUTE); const latLng = location?.split(",", 2).map((el) => parseFloat(el)) as [ number, number ] | undefined; diff --git a/apps/client/src/widgets/collections/geomap/Tooltips.tsx b/apps/client/src/widgets/collections/geomap/Tooltips.tsx index 807e5c8946..387056a4f6 100644 --- a/apps/client/src/widgets/collections/geomap/Tooltips.tsx +++ b/apps/client/src/widgets/collections/geomap/Tooltips.tsx @@ -1,4 +1,4 @@ -import { MapMouseEvent, Popup } from "maplibre-gl"; +import { type MapGeoJSONFeature, MapMouseEvent, Popup } from "maplibre-gl"; import { useContext, useEffect } from "preact/hooks"; import { ParentMap } from "./map"; @@ -17,10 +17,12 @@ export default function Tooltips() { className: "marker-tooltip" }); - function onMouseEnter(e: MapMouseEvent) { - const feature = e.features[0]; + function onMouseEnter(e: MapMouseEvent & { features?: MapGeoJSONFeature[]; }) { + const feature = e.features?.[0]; + if (!feature || !map || feature.geometry.type !== "Point") return; + tooltip - .setLngLat(feature.geometry.coordinates) + .setLngLat(feature.geometry.coordinates as [ number, number ]) .setHTML(`${feature.properties.name}`) .addTo(map); }