Skip to content

Commit

Permalink
improve optional and nullish chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
KrAbhas committed Dec 25, 2023
1 parent b5f1a17 commit 89ed621
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt
const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton || shouldShowNextSteps;
const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport);
const formattedAmount = CurrencyUtils.convertToDisplayString(reimbursableTotal, moneyRequestReport.currency);
const isMoreContentShown = shouldShowNextSteps || (shouldShowAnyButton && isSmallScreenWidth);
const isMoreContentShown = shouldShowNextSteps ?? (shouldShowAnyButton && isSmallScreenWidth);

const threeDotsMenuItems = [HeaderUtils.getPinMenuItem(moneyRequestReport)];
if (isPayer && isSettled) {
Expand Down Expand Up @@ -136,7 +136,7 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt
<SettlementButton
currency={moneyRequestReport.currency}

Check failure on line 137 in src/components/MoneyReportHeader.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Type '{ currency: string | undefined; policyID: string | undefined; chatReportID: string | undefined; iouReport: Report; onPress: (paymentType: any) => void; enablePaymentsRoute: "enable-payments"; ... 4 more ...; formattedAmount: string; }' is not assignable to type 'IntrinsicAttributes & Omit<Omit<TProps, "navigation">, "nvp_lastPaymentMethod">'.
policyID={moneyRequestReport.policyID}
chatReportID={chatReport.reportID}
chatReportID={chatReport?.reportID}
iouReport={moneyRequestReport}
onPress={(paymentType) => IOU.payMoneyRequest(paymentType, chatReport, moneyRequestReport)}

Check failure on line 141 in src/components/MoneyReportHeader.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Parameter 'paymentType' implicitly has an 'any' type.

Check failure on line 141 in src/components/MoneyReportHeader.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type 'OnyxEntry<Report>' is not assignable to parameter of type 'Object'.
enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS}
Expand All @@ -152,7 +152,7 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt
<View style={styles.pv2}>
<Button
medium
success={chatReport.isOwnPolicyExpenseChat}
success={chatReport?.isOwnPolicyExpenseChat}
text={translate('common.submit')}
style={[styles.mnw120, styles.pv2, styles.pr0]}
onPress={() => IOU.submitReport(moneyRequestReport)}
Expand Down Expand Up @@ -181,7 +181,7 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt
<View style={[styles.ph5, styles.pb2]}>
<Button
medium
success={chatReport.isOwnPolicyExpenseChat}
success={chatReport?.isOwnPolicyExpenseChat}
text={translate('common.submit')}
style={[styles.w100, styles.pr0]}
onPress={() => IOU.submitReport(moneyRequestReport)}
Expand Down

0 comments on commit 89ed621

Please sign in to comment.