From c5a6703d38cdf5a636a49e77b113d1d7cfea16ef Mon Sep 17 00:00:00 2001 From: zfurtak Date: Fri, 20 Sep 2024 14:44:16 +0100 Subject: [PATCH] Fixed ts issues --- src/pages/Debug/DebugDetails.tsx | 2 +- .../workspace/categories/WorkspaceCategoriesSettingsPage.tsx | 2 +- src/pages/workspace/reportFields/WorkspaceReportFieldsPage.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Debug/DebugDetails.tsx b/src/pages/Debug/DebugDetails.tsx index 3d7290d03b79..bf4e575f19af 100644 --- a/src/pages/Debug/DebugDetails.tsx +++ b/src/pages/Debug/DebugDetails.tsx @@ -74,7 +74,7 @@ function DebugDetails({data, onSave, onDelete, validate}: DebugDetailsProps) { ) // eslint-disable-next-line @typescript-eslint/no-unsafe-argument .map(([key, value]) => [key, DebugUtils.onyxDataToString(value)]) - .sort((a, b) => a.at(0).localeCompare(b.at(0))), + .sort((a, b) => (a.at(0) ?? '').localeCompare(b.at(0) ?? '')), [data], ); const dateTimeFields = useMemo(() => Object.entries(data ?? {}).filter(([key]) => DETAILS_DATETIME_FIELDS.includes(key as DetailsDatetimeFieldsKeys)) as Array<[string, string]>, [data]); diff --git a/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx index bfb6739c79cf..10274527f682 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx @@ -102,7 +102,7 @@ function WorkspaceCategoriesSettingsPage({policy, route}: WorkspaceCategoriesSet shouldPlaceSubtitleBelowSwitch /> - {canUseWorkspaceRules && !!currentPolicy && sections.at(0).data.length > 0 && ( + {canUseWorkspaceRules && !!currentPolicy && (sections.at(0)?.data?.length ?? 0) > 0 && ( diff --git a/src/pages/workspace/reportFields/WorkspaceReportFieldsPage.tsx b/src/pages/workspace/reportFields/WorkspaceReportFieldsPage.tsx index bffc1c75ed95..8fe57a13ef95 100644 --- a/src/pages/workspace/reportFields/WorkspaceReportFieldsPage.tsx +++ b/src/pages/workspace/reportFields/WorkspaceReportFieldsPage.tsx @@ -127,7 +127,7 @@ function WorkspaceReportFieldsPage({ ]; }, [filteredPolicyFieldList, policy, selectedReportFields, canSelectMultiple, translate]); - useAutoTurnSelectionModeOffWhenHasNoActiveOption(reportFieldsSections.at(0).data); + useAutoTurnSelectionModeOffWhenHasNoActiveOption(reportFieldsSections.at(0)?.data ?? ([] as ListItem[])); const updateSelectedReportFields = (item: ReportFieldForList) => { const fieldKey = ReportUtils.getReportFieldKey(item.fieldID);