mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-18 15:54:22 +00:00
Add generic to use-control for inferring return type (#1739)
This commit is contained in:
parent
4a73faaeea
commit
554e03eaa7
@ -7,8 +7,8 @@ type ControlOptions = {
|
||||
position?: ControlPosition;
|
||||
};
|
||||
|
||||
export default function useControl(
|
||||
onCreate: (context: MapContextValue) => IControl,
|
||||
export default function useControl<T extends IControl>(
|
||||
onCreate: (context: MapContextValue) => T,
|
||||
onRemove?: ((context: MapContextValue) => void) | ControlOptions,
|
||||
opts?: ControlOptions
|
||||
) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user