From 554e03eaa7a2008c08da936efe3b6a9ad5bfc9f2 Mon Sep 17 00:00:00 2001 From: Max Nowack Date: Mon, 21 Feb 2022 19:55:20 +0100 Subject: [PATCH] Add generic to use-control for inferring return type (#1739) --- src/components/use-control.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/use-control.ts b/src/components/use-control.ts index 104af51c..d4c8a51e 100644 --- a/src/components/use-control.ts +++ b/src/components/use-control.ts @@ -7,8 +7,8 @@ type ControlOptions = { position?: ControlPosition; }; -export default function useControl( - onCreate: (context: MapContextValue) => IControl, +export default function useControl( + onCreate: (context: MapContextValue) => T, onRemove?: ((context: MapContextValue) => void) | ControlOptions, opts?: ControlOptions ) {