From 09ce8ced4fe45564016f01740ffad8a75842de65 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Mon, 2 Jun 2025 10:38:16 +0200 Subject: [PATCH] remove type casting --- src/components/Search/SearchList.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Search/SearchList.tsx b/src/components/Search/SearchList.tsx index 14ddaa9259c1..4e31246473d2 100644 --- a/src/components/Search/SearchList.tsx +++ b/src/components/Search/SearchList.tsx @@ -311,12 +311,12 @@ function SearchList( const getItemHeight = useCallback( (item: SearchListItem): number => { try { - const reportListItem = item as ReportListItemType; - const transactionListItem = item as TransactionListItemType; - const reportActionListItem = item as ReportActionListItemType; + const reportListItem = isReportListItemType(item) ? item : null; + const transactionListItem = isTransactionListItemType(item) ? item : null; + const reportActionListItem = isReportActionListItemType(item) ? item : null; - const isTransaction = isTransactionListItemType(transactionListItem); - const isReportAction = isReportActionListItemType(reportActionListItem); + const isTransaction = !!transactionListItem; + const isReportAction = !!reportActionListItem; if (isTransaction || isReportAction) { if (queryJSONType === CONST.SEARCH.DATA_TYPES.CHAT) { @@ -342,7 +342,7 @@ function SearchList( return heightConstants; } - if (isReportListItemType(reportListItem)) { + if (reportListItem) { if (!reportListItem.transactions || reportListItem.transactions.length === 0) { return Math.max(ITEM_HEIGHTS.HEADER, 1); }