@@ -1198,7 +1198,7 @@ function isTagModificationAction(actionName: string): boolean {
11981198 * Used for Send Money flow, which is a special case where we have no IOU create action and only one IOU pay action.
11991199 * In other reports, pay actions do not count as a transactions, but this is an exception to this rule.
12001200 */
1201- function getSendMoneyFlowOneTransactionThreadID ( actions : OnyxEntry < ReportActions > | ReportAction [ ] , chatReport : OnyxEntry < Report > ) {
1201+ function getSendMoneyFlowOneTransactionReportAction ( actions : OnyxEntry < ReportActions > | ReportAction [ ] , chatReport : OnyxEntry < Report > ) : ReportAction < 'IOU' > | undefined {
12021202 if ( ! chatReport ) {
12031203 return undefined ;
12041204 }
@@ -1218,7 +1218,7 @@ function getSendMoneyFlowOneTransactionThreadID(actions: OnyxEntry<ReportActions
12181218 // ...and can only be triggered on DM chats
12191219 const isDM = type === CONST . REPORT . TYPE . CHAT && ! chatType && ! ( parentReportID && parentReportActionID ) ;
12201220
1221- return isFirstActionPay && isDM ? iouActions . at ( 0 ) ?. childReportID : undefined ;
1221+ return isFirstActionPay && isDM ? iouActions . at ( 0 ) : undefined ;
12221222}
12231223
12241224/** Whether action has no linked report by design */
@@ -1256,13 +1256,13 @@ const isIOUActionMatchingTransactionList = (
12561256 * Gets the reportID for the transaction thread associated with a report by iterating over the reportActions and identifying the IOU report actions.
12571257 * Returns a reportID if there is exactly one transaction thread for the report, and null otherwise.
12581258 */
1259- function getOneTransactionThreadReportID (
1259+ function getOneTransactionThreadReportAction (
12601260 report : OnyxEntry < Report > ,
12611261 chatReport : OnyxEntry < Report > ,
12621262 reportActions : OnyxEntry < ReportActions > | ReportAction [ ] ,
12631263 isOffline : boolean | undefined = undefined ,
12641264 reportTransactionIDs ?: string [ ] ,
1265- ) : string | undefined {
1265+ ) : ReportAction < 'IOU' > | undefined {
12661266 // If the report is not an IOU, Expense report, or Invoice, it shouldn't be treated as one-transaction report.
12671267 if ( report ?. type !== CONST . REPORT . TYPE . IOU && report ?. type !== CONST . REPORT . TYPE . EXPENSE && report ?. type !== CONST . REPORT . TYPE . INVOICE ) {
12681268 return ;
@@ -1273,10 +1273,10 @@ function getOneTransactionThreadReportID(
12731273 return ;
12741274 }
12751275
1276- const sendMoneyFlowID = getSendMoneyFlowOneTransactionThreadID ( reportActions , chatReport ) ;
1276+ const sendMoneyFlow = getSendMoneyFlowOneTransactionReportAction ( reportActions , chatReport ) ;
12771277
1278- if ( sendMoneyFlowID ) {
1279- return sendMoneyFlowID ;
1278+ if ( sendMoneyFlow ?. childReportID ) {
1279+ return sendMoneyFlow ;
12801280 }
12811281
12821282 const iouRequestActions = [ ] ;
@@ -1322,7 +1322,11 @@ function getOneTransactionThreadReportID(
13221322 }
13231323
13241324 // Ensure we have a childReportID associated with the IOU report action
1325- return singleAction ?. childReportID ;
1325+ return singleAction ;
1326+ }
1327+
1328+ function getOneTransactionThreadReportID ( ...args : Parameters < typeof getOneTransactionThreadReportAction > ) : string | undefined {
1329+ return getOneTransactionThreadReportAction ( ...args ) ?. childReportID ;
13261330}
13271331
13281332/**
@@ -2968,6 +2972,7 @@ export {
29682972 getMessageOfOldDotReportAction ,
29692973 getMostRecentIOURequestActionID ,
29702974 getNumberOfMoneyRequests ,
2975+ getOneTransactionThreadReportAction ,
29712976 getOneTransactionThreadReportID ,
29722977 getOriginalMessage ,
29732978 getAddedApprovalRuleMessage ,
@@ -3091,7 +3096,7 @@ export {
30913096 getWorkspaceDescriptionUpdatedMessage ,
30923097 getWorkspaceReportFieldAddMessage ,
30933098 getWorkspaceCustomUnitRateAddedMessage ,
3094- getSendMoneyFlowOneTransactionThreadID ,
3099+ getSendMoneyFlowOneTransactionReportAction ,
30953100 getWorkspaceTagUpdateMessage ,
30963101 getWorkspaceReportFieldUpdateMessage ,
30973102 getWorkspaceReportFieldDeleteMessage ,
0 commit comments