From 8c39d03beb116ca98dbba3597b001e25fb5e7e51 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 15 Nov 2024 14:18:21 -0800 Subject: [PATCH] export `UseAnchor` subtypes: - AnchorAssign - AnchorAttributes - AnchorOnClick --- src/leaf/map/fullscreen/state/use-anchor.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/leaf/map/fullscreen/state/use-anchor.ts b/src/leaf/map/fullscreen/state/use-anchor.ts index d1548da..6dce45d 100644 --- a/src/leaf/map/fullscreen/state/use-anchor.ts +++ b/src/leaf/map/fullscreen/state/use-anchor.ts @@ -1,13 +1,16 @@ import { DomEvent } from 'leaflet' +export type AnchorAttributes = Record export type UseAnchorOptions = { - attributes: Record + attributes: AnchorAttributes element: HTMLElement } +export type AnchorAssign = (props: AnchorAttributes) => HTMLElement +export type AnchorOnClick = (handler: (event: Event) => Promise) => void export type UseAnchor = { - assign: (props: Record) => HTMLElement - onClick: (handler: (event: Event) => Promise) => void + assign: AnchorAssign + onClick: AnchorOnClick } const domEventOn = < @@ -22,7 +25,7 @@ export function useAnchor({ attributes, element, }: UseAnchorOptions): UseAnchor { - function assign(anchorAttributes: Record): HTMLElement { + function assign(anchorAttributes: AnchorAttributes): HTMLElement { return Object.assign(element, anchorAttributes) }