From 768dc82f1d3369dd0295cb642b90b060e169d7d8 Mon Sep 17 00:00:00 2001 From: Claire Dagan Date: Mon, 9 Dec 2024 14:14:21 +0100 Subject: [PATCH] [Tech] add typing --- .../src/features/Dashboard/components/Layers/style.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/features/Dashboard/components/Layers/style.ts b/frontend/src/features/Dashboard/components/Layers/style.ts index 2956a83b1..29765543e 100644 --- a/frontend/src/features/Dashboard/components/Layers/style.ts +++ b/frontend/src/features/Dashboard/components/Layers/style.ts @@ -4,8 +4,14 @@ import { getRegulatoryLayerStyle } from '@features/map/layers/styles/administrat import { editingReportingStyleFn } from '@features/Reportings/components/ReportingLayer/Reporting/style' import { getVigilanceAreaLayerStyle } from '@features/VigilanceArea/components/VigilanceAreaLayer/style' -export const getDashboardStyle = feature => { - const featureType = feature.getId().split(':')[0] +import type { FeatureLike } from 'ol/Feature' + +export const getDashboardStyle = (feature: FeatureLike) => { + const featureId = String(feature.getId()) + if (!featureId) { + return undefined + } + const featureType = featureId.split(':')[0] if (featureType === Dashboard.Layer.DASHBOARD_REGULATORY_AREAS) { return getRegulatoryLayerStyle(feature)