From a3302a82fecd1e564e7123995506c5192749d565 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 24 Oct 2024 17:34:23 -0600 Subject: [PATCH] add more types --- src/libs/SearchUIUtils.ts | 4 ++-- src/libs/actions/IOU.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index d105ece30656..6fdfd8233df3 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -269,12 +269,12 @@ function getAction(data: OnyxTypes.SearchResults['data'], key: string, currentUs const allTransactions = isTransactionEntry(key) ? transaction : Object.keys(data).filter((item) => item.startsWith(ONYXKEYS.COLLECTION.TRANSACTION)) ?? {}; // TODO: update isSettled to take report object instead of connect to Onyx - if (ReportUtils.isSettled(report.reportID)) { + if (ReportUtils.isSettled(report?.reportID)) { return CONST.SEARCH.ACTION_TYPES.PAID; } // TODO: create function to determine if report is done - if (ReportUtils.isSettled(report.reportID)) { + if (ReportUtils.isSettled(report?.reportID)) { return CONST.SEARCH.ACTION_TYPES.DONE; } diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 0a07184c0852..08fccd65a426 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -66,7 +66,7 @@ import type {ErrorFields, Errors} from '@src/types/onyx/OnyxCommon'; import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; import type ReportAction from '@src/types/onyx/ReportAction'; import type {OnyxData} from '@src/types/onyx/Request'; -import type {SearchTransaction} from '@src/types/onyx/SearchResults'; +import type {SearchReport, SearchTransaction} from '@src/types/onyx/SearchResults'; import type {Comment, Receipt, ReceiptSource, Routes, SplitShares, TransactionChanges, WaypointCollection} from '@src/types/onyx/Transaction'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import * as CachedPDFPaths from './CachedPDFPaths'; @@ -7016,7 +7016,7 @@ function sendMoneyWithWallet(report: OnyxEntry, amount: number Report.notifyNewAction(params.chatReportID, managerID); } -function canApproveIOU(iouReport: OnyxTypes.OnyxInputOrEntry, policy: OnyxTypes.OnyxInputOrEntry) { +function canApproveIOU(iouReport: OnyxTypes.OnyxInputOrEntry | SearchReport, policy: OnyxTypes.OnyxInputOrEntry) { // Only expense reports can be approved const isPaidGroupPolicy = policy && PolicyUtils.isPaidGroupPolicy(policy); if (!isPaidGroupPolicy) { @@ -7041,8 +7041,8 @@ function canApproveIOU(iouReport: OnyxTypes.OnyxInputOrEntry, } function canIOUBePaid( - iouReport: OnyxTypes.OnyxInputOrEntry, - chatReport: OnyxTypes.OnyxInputOrEntry, + iouReport: OnyxTypes.OnyxInputOrEntry | SearchReport, + chatReport: OnyxTypes.OnyxInputOrEntry | SearchReport, policy: OnyxTypes.OnyxInputOrEntry, transactions?: OnyxTypes.Transaction[], onlyShowPayElsewhere = false, @@ -7105,7 +7105,7 @@ function canIOUBePaid( } function canReportBeSubmitted( - moneyRequestReport: OnyxTypes.OnyxInputOrEntry, + moneyRequestReport: OnyxTypes.OnyxInputOrEntry | SearchReport, policy: OnyxTypes.OnyxInputOrEntry, currentUserAccountID: number, transaction?: OnyxTypes.Transaction,