diff --git a/src/Components/Map/Layer.tsx b/src/Components/Map/Layer.tsx index c15987e..4b50886 100644 --- a/src/Components/Map/Layer.tsx +++ b/src/Components/Map/Layer.tsx @@ -1,11 +1,6 @@ /* eslint-disable @typescript-eslint/restrict-plus-operands */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unnecessary-condition */ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/prefer-optional-chain */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { Children, isValidElement, useEffect, useState } from 'react' import { Marker, Tooltip } from 'react-leaflet' @@ -319,7 +314,7 @@ export const Layer = ({ )} - {item.name ? item.name : getValue(item, itemNameField)} + {item.name ? item.name : `${getValue(item, itemNameField)}`} ) diff --git a/src/Utils/GetValue.ts b/src/Utils/GetValue.ts index ff15959..2d8500f 100644 --- a/src/Utils/GetValue.ts +++ b/src/Utils/GetValue.ts @@ -1,14 +1,17 @@ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -export function getValue(obj, path) { +import type { Item } from '#types/Item' + +function getNestedValue(obj: Object, path: string) { + re +} + +export function getValue(obj: Item | undefined, path: string): Item | string | undefined { if (!obj || typeof path !== 'string') return undefined const pathArray = path.split('.') // Use a different variable for the split path for (let i = 0, len = pathArray.length; i < len; i++) { if (!obj) return undefined // Check if obj is falsy at each step // eslint-disable-next-line security/detect-object-injection - obj = obj[pathArray[i]] // Dive one level deeper + obj = obj[pathArray[i]] as Item // Dive one level deeper } return obj // Return the final value } diff --git a/types/Item.d.ts b/types/Item.d.ts index 47560e6..cb8da0b 100644 --- a/types/Item.d.ts +++ b/types/Item.d.ts @@ -24,8 +24,7 @@ export interface Item { slug?: string user_created?: UserItem image?: string - // eslint-disable-next-line @typescript-eslint/no-explicit-any - [key: string]: any + group_type: string /* constructor( id: string, name: string,