From 170d6cc82763149dd5e5ac53b2374ab971e16d2c Mon Sep 17 00:00:00 2001 From: steveoh Date: Wed, 13 Nov 2024 16:48:45 -0700 Subject: [PATCH] chore: correct hook usage types --- src/components/contexts/MapProvider.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/contexts/MapProvider.tsx b/src/components/contexts/MapProvider.tsx index b6538247..2b8cac3b 100644 --- a/src/components/contexts/MapProvider.tsx +++ b/src/components/contexts/MapProvider.tsx @@ -4,10 +4,11 @@ import { useGraphicManager } from '@ugrc/utilities/hooks'; import PropTypes from 'prop-types'; import { createContext, ReactNode, useState } from 'react'; +type GraphicOptions = Graphic | Graphic[] | null; export const MapContext = createContext<{ mapView: MapView | null; - setMapView: (mapView: MapView) => void; - placeGraphic: (graphic: Graphic | Graphic[] | null) => void; + setMapView: (mapView: MapView | null) => void; + placeGraphic: (graphic: GraphicOptions) => void; zoom: (geometry: __esri.GoToTarget2D) => void; } | null>(null); @@ -25,7 +26,7 @@ export const MapProvider = ({ children }: { children: ReactNode }) => { mapView.goTo(geometry); }; - const placeGraphic = (graphic: Graphic | Graphic[] | null): void => { + const placeGraphic = (graphic: GraphicOptions): void => { setGraphic(graphic); };