From 5e3aca19598ef74906d6a27819e66e3584ec36b7 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 16 May 2025 11:22:13 +0200 Subject: [PATCH] correct type import --- src/Components/Profile/ProfileForm.tsx | 4 ++-- src/Utils/MarkerIconFactory.ts | 7 ++----- src/types/Item.d.ts | 4 ++-- src/types/LayerProps.d.ts | 4 ++-- src/types/MarkerIcon.d.ts | 4 ++++ 5 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 src/types/MarkerIcon.d.ts diff --git a/src/Components/Profile/ProfileForm.tsx b/src/Components/Profile/ProfileForm.tsx index bdb1b76d..c68f7dcc 100644 --- a/src/Components/Profile/ProfileForm.tsx +++ b/src/Components/Profile/ProfileForm.tsx @@ -21,8 +21,8 @@ import { TabsForm } from './Templates/TabsForm' import type { FormState } from '#types/FormState' import type { Item } from '#types/Item' +import type { MarkerIcon } from '#types/MarkerIcon' import type { Tag } from '#types/Tag' -import type { markerIcon } from '#utils/MarkerIconFactory' /** * @category Profile @@ -40,7 +40,7 @@ export function ProfileForm() { telephone: '', next_appointment: '', image: '', - marker_icon: {} as markerIcon, + marker_icon: {} as MarkerIcon, offers: [] as Tag[], needs: [] as Tag[], relations: [] as Item[], diff --git a/src/Utils/MarkerIconFactory.ts b/src/Utils/MarkerIconFactory.ts index d9c27705..68a98a79 100644 --- a/src/Utils/MarkerIconFactory.ts +++ b/src/Utils/MarkerIconFactory.ts @@ -2,10 +2,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-return */ import { divIcon, Point } from 'leaflet' -export interface markerIcon { - image: string - size?: number -} +import type { MarkerIcon } from '#types/MarkerIcon' const createSvg = (shape: string, markerColor: string, borderColor: string) => { const svgMap = { @@ -38,7 +35,7 @@ const MarkerIconFactory = ( shape: string, color1: string, color2: string, - icon?: markerIcon, + icon?: MarkerIcon, assetsURL?: string, ) => { if (icon && assetsURL) diff --git a/src/types/Item.d.ts b/src/types/Item.d.ts index dba3aa8e..d1073884 100644 --- a/src/types/Item.d.ts +++ b/src/types/Item.d.ts @@ -1,6 +1,6 @@ -import type { markerIcon } from '#utils/MarkerIconFactory' import type { ItemsApi } from './ItemsApi' import type { LayerProps } from './LayerProps' +import type { MarkerIcon } from './MarkerIcon' import type { Relation } from './Relation' import type { UserItem } from './UserItem' import type { Point } from 'geojson' @@ -44,7 +44,7 @@ export interface Item { needs?: TagIds status?: string color?: string - markerIcon?: markerIcon + markerIcon?: MarkerIcon avatar?: string new?: boolean contact?: string diff --git a/src/types/LayerProps.d.ts b/src/types/LayerProps.d.ts index 0085af2c..b625d830 100644 --- a/src/types/LayerProps.d.ts +++ b/src/types/LayerProps.d.ts @@ -1,8 +1,8 @@ -import type { markerIcon } from '#utils/MarkerIconFactory' import type { Item } from './Item' import type { ItemFormPopupProps } from './ItemFormPopupProps' import type { ItemsApi } from './ItemsApi' import type { ItemType } from './ItemType' +import type { MarkerIcon } from './MarkerIcon' /** * @category Types @@ -15,7 +15,7 @@ export interface LayerProps { menuIcon: string menuColor: string menuText: string - markerIcon: markerIcon + markerIcon: MarkerIcon markerShape: string markerDefaultColor: string markerDefaultColor2?: string diff --git a/src/types/MarkerIcon.d.ts b/src/types/MarkerIcon.d.ts new file mode 100644 index 00000000..052311c8 --- /dev/null +++ b/src/types/MarkerIcon.d.ts @@ -0,0 +1,4 @@ +export interface MarkerIcon { + image: string + size?: number +}