@@ -35,9 +35,9 @@ import {approveMoneyRequest, savePreferredPaymentMethod as savePreferredPaymentM
3535import CONST from '@src/CONST' ;
3636import ONYXKEYS from '@src/ONYXKEYS' ;
3737import ROUTES from '@src/ROUTES' ;
38- import type { AccountData , BankAccount , LastPaymentMethodType , Policy } from '@src/types/onyx' ;
38+ import type { AccountData , BankAccount , BankAccountList , FundList , LastPaymentMethodType , Policy } from '@src/types/onyx' ;
3939import type { PaymentMethodType } from '@src/types/onyx/OriginalMessage' ;
40- import { isEmptyObject } from '@src/types/utils/EmptyObject' ;
40+ import { getEmptyObject , isEmptyObject } from '@src/types/utils/EmptyObject' ;
4141import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue' ;
4242import type SettlementButtonProps from './types' ;
4343
@@ -104,7 +104,7 @@ function SettlementButton({
104104 } ) ;
105105
106106 const lastBankAccountID = getLastPolicyBankAccountID ( policyIDKey , iouReport ?. type as keyof LastPaymentMethodType ) ;
107- const [ fundList = { } ] = useOnyx ( ONYXKEYS . FUND_LIST , { canBeMissing : true } ) ;
107+ const [ fundList = getEmptyObject < FundList > ( ) ] = useOnyx ( ONYXKEYS . FUND_LIST , { canBeMissing : true } ) ;
108108 const [ policies ] = useOnyx ( ONYXKEYS . COLLECTION . POLICY , { canBeMissing : true } ) ;
109109 const currentUserAccountID = getCurrentUserAccountID ( ) . toString ( ) ;
110110 const activeAdminPolicies = getActiveAdminWorkspaces ( policies , currentUserAccountID ) . sort ( ( a , b ) => ( a . name || '' ) . localeCompare ( b . name || '' ) ) ;
@@ -115,7 +115,7 @@ function SettlementButton({
115115 const policy = policies ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ] ;
116116 const isLastPaymentPolicy = ! Object . values ( { ...CONST . PAYMENT_METHODS , ...CONST . IOU . PAYMENT_TYPE } ) . includes ( lastPaymentMethod as PaymentMethod ) ;
117117 const lastPaymentPolicy = isLastPaymentPolicy ? policies ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ lastPaymentMethod } ` ] : undefined ;
118- const [ bankAccountList = { } ] = useOnyx ( ONYXKEYS . BANK_ACCOUNT_LIST , { canBeMissing : true } ) ;
118+ const [ bankAccountList = getEmptyObject < BankAccountList > ( ) ] = useOnyx ( ONYXKEYS . BANK_ACCOUNT_LIST , { canBeMissing : true } ) ;
119119 const bankAccount = bankAccountList [ lastBankAccountID ?? CONST . DEFAULT_NUMBER_ID ] ;
120120 const isExpenseReport = isExpenseReportUtil ( iouReport ) ;
121121 // whether the user has single policy and the expense is p2p
0 commit comments