From 98c6f6cf062236baa62670e843d987447beddd30 Mon Sep 17 00:00:00 2001 From: Paul Nothaft Date: Mon, 4 May 2026 12:24:21 +0200 Subject: [PATCH] chore(events): type FolderTreeNode entries with ExternalEntry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to PR #378 — drops the (e: any) / (d: any) casts in the external-folder-tree picker. ExternalEntry is already exported from externalMedia.service.ts; the call site just wasn't using it. - Import the type alongside the service. - Annotate the dirs filter callback so `e.type` is the union 'dir' | 'file' instead of any. - Drop the (d: any) annotation from the map — TypeScript infers ExternalEntry from the typed `dirs` array. No behaviour change, no test impact. `npx tsc --noEmit` clean, `npx eslint` clean. --- frontend/src/pages/admin/EventDetailsPage.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/admin/EventDetailsPage.tsx b/frontend/src/pages/admin/EventDetailsPage.tsx index f06ff64c..b6886e5f 100644 --- a/frontend/src/pages/admin/EventDetailsPage.tsx +++ b/frontend/src/pages/admin/EventDetailsPage.tsx @@ -66,7 +66,7 @@ import { api } from '../../config/api'; import { buildResourceUrl, buildShareLinkUrl } from '../../utils/url'; import { isGalleryPublic, normalizeRequirePassword } from '../../utils/accessControl'; import { archiveService } from '../../services/archive.service'; -import { externalMediaService } from '../../services/externalMedia.service'; +import { externalMediaService, type ExternalEntry } from '../../services/externalMedia.service'; import { photosService, AdminPhoto, type PhotoFilters as PhotoFilterParams, type FeedbackFilters } from '../../services/photos.service'; import { feedbackService, FeedbackSettings as FeedbackSettingsType } from '../../services/feedback.service'; import { cssTemplatesService, type EnabledTemplate } from '../../services/cssTemplates.service'; @@ -92,7 +92,7 @@ const FolderTreeNode: React.FC<{ staleTime: 30_000 }); - const dirs = (data?.entries || []).filter((e: any) => e.type === 'dir'); + const dirs: ExternalEntry[] = (data?.entries || []).filter((e: ExternalEntry) => e.type === 'dir'); const showEmpty = isExpanded && !isLoading && !isError && dirs.length === 0; const indentStyle = { paddingLeft: depth * 16 + 4 }; const childIndentStyle = { paddingLeft: (depth + 1) * 16 + 4 }; @@ -158,7 +158,7 @@ const FolderTreeNode: React.FC<{ {t('events.externalFolderEmpty', 'No subfolders')} )} - {dirs.map((d: any) => { + {dirs.map((d) => { const childPath = path ? `${path}/${d.name}` : d.name; return (