From d38f3c1d926395cad98c7353cb9688d4d7d94c21 Mon Sep 17 00:00:00 2001 From: Bijay Rauniyar Date: Wed, 11 Dec 2024 11:31:19 +0545 Subject: [PATCH] refactor: update type for coordinates --- .../common/MapLibreComponents/NewAsyncPopup/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/components/common/MapLibreComponents/NewAsyncPopup/index.tsx b/src/frontend/src/components/common/MapLibreComponents/NewAsyncPopup/index.tsx index 3e88f5b3..745646c2 100644 --- a/src/frontend/src/components/common/MapLibreComponents/NewAsyncPopup/index.tsx +++ b/src/frontend/src/components/common/MapLibreComponents/NewAsyncPopup/index.tsx @@ -6,7 +6,7 @@ import '@Components/common/MapLibreComponents/map.css'; import { Button } from '@Components/RadixComponents/Button'; import Skeleton from '@Components/RadixComponents/Skeleton'; -import type { MapMouseEvent } from 'maplibre-gl'; +import type { LngLatLike, MapMouseEvent } from 'maplibre-gl'; import { Popup } from 'maplibre-gl'; import 'maplibre-gl/dist/maplibre-gl.css'; import { forwardRef, useEffect, useMemo, useRef, useState } from 'react'; @@ -89,7 +89,7 @@ const AsyncPopup = forwardRef( const [properties, setProperties] = useState | null>( null, ); - const [coordinates, setCoordinates] = useState(null); + const [coordinates, setCoordinates] = useState(); const [isPopupOpen, setIsPopupOpen] = useState(false); useEffect(() => { @@ -116,7 +116,7 @@ const AsyncPopup = forwardRef( }, ); - setCoordinates(e.lngLat); + setCoordinates(e.lngLat as unknown as number[]); // popup.setLngLat(e.lngLat); } map.on('click', displayPopup); @@ -140,7 +140,7 @@ const AsyncPopup = forwardRef( />, ); popup.setHTML(htmlString).addTo(map); - popup.setLngLat(coordinates); + popup.setLngLat(coordinates as LngLatLike); setIsPopupOpen(true); }, [ handleBtnClick,