From a717e248bdf63282ffd82d6c52f52b59faa1137a Mon Sep 17 00:00:00 2001 From: Martin Schuhfuss Date: Thu, 28 Nov 2024 11:05:22 +0100 Subject: [PATCH] fix: remove explicit types for components using forwardRef closes #619 closes #617 --- src/components/advanced-marker.tsx | 8 ++++---- src/components/marker.tsx | 13 +++++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/components/advanced-marker.tsx b/src/components/advanced-marker.tsx index 9ab4724a..777b78c1 100644 --- a/src/components/advanced-marker.tsx +++ b/src/components/advanced-marker.tsx @@ -3,7 +3,6 @@ import React, { Children, CSSProperties, forwardRef, - ForwardRefExoticComponent, useCallback, useEffect, useImperativeHandle, @@ -275,8 +274,8 @@ function useAdvancedMarker(props: AdvancedMarkerProps) { return [marker, contentContainer] as const; } -export const AdvancedMarker: ForwardRefExoticComponent = - forwardRef((props, ref: Ref) => { +export const AdvancedMarker = forwardRef( + (props: AdvancedMarkerProps, ref: Ref) => { const {children, style, className, anchorPoint} = props; const [marker, contentContainer] = useAdvancedMarker(props); @@ -300,7 +299,8 @@ export const AdvancedMarker: ForwardRefExoticComponent = )} ); - }); + } +); export function useAdvancedMarkerRef() { const [marker, setMarker] = diff --git a/src/components/marker.tsx b/src/components/marker.tsx index a0bbdb6c..0b7983e2 100644 --- a/src/components/marker.tsx +++ b/src/components/marker.tsx @@ -1,7 +1,6 @@ /* eslint-disable complexity */ import React, { forwardRef, - ForwardRefExoticComponent, useCallback, useEffect, useImperativeHandle, @@ -119,15 +118,13 @@ function useMarker(props: MarkerProps) { /** * Component to render a marker on a map */ -export const Marker: ForwardRefExoticComponent = forwardRef( - (props: MarkerProps, ref: MarkerRef) => { - const marker = useMarker(props); +export const Marker = forwardRef((props: MarkerProps, ref: MarkerRef) => { + const marker = useMarker(props); - useImperativeHandle(ref, () => marker, [marker]); + useImperativeHandle(ref, () => marker, [marker]); - return <>; - } -); + return <>; +}); export function useMarkerRef() { const [marker, setMarker] = useState(null);