Skip to content

Commit

Permalink
fix regression, type update
Browse files Browse the repository at this point in the history
  • Loading branch information
pasyukevich committed May 7, 2024
1 parent 43cb010 commit c5c3c45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ function getPolicy(policyID: string | undefined): Policy | EmptyObject {
/**
* Returns a primary policy for the user
*/
function getPrimaryPolicy(activePolicyID?: string): Policy | undefined {
function getPrimaryPolicy(activePolicyID?: OnyxEntry<string>): Policy | undefined {
const activeAdminWorkspaces = PolicyUtils.getActiveAdminWorkspaces(allPolicies);
const primaryPolicy: Policy | null | undefined = allPolicies?.[activePolicyID ?? ''];

Expand Down
5 changes: 3 additions & 2 deletions src/pages/iou/request/MoneyRequestParticipantsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function MoneyRequestParticipantsSelector({
];

if (iouType === CONST.IOU.TYPE.INVOICE) {
const primaryPolicy = Policy.getPrimaryPolicy(activePolicyID ?? undefined);
const primaryPolicy = Policy.getPrimaryPolicy(activePolicyID);

newParticipants.push({
policyID: primaryPolicy?.id,
Expand Down Expand Up @@ -276,7 +276,8 @@ function MoneyRequestParticipantsSelector({

// canUseP2PDistanceRequests is true if the iouType is track expense, but we don't want to allow splitting distance with track expense yet
const isAllowedToSplit =
(canUseP2PDistanceRequests ?? iouRequestType !== CONST.IOU.REQUEST_TYPE.DISTANCE) &&
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
(canUseP2PDistanceRequests || iouRequestType !== CONST.IOU.REQUEST_TYPE.DISTANCE) &&
![CONST.IOU.TYPE.PAY, CONST.IOU.TYPE.TRACK, CONST.IOU.TYPE.INVOICE].some((option) => option === iouType) &&
![CONST.IOU.ACTION.SHARE, CONST.IOU.ACTION.SUBMIT, CONST.IOU.ACTION.CATEGORIZE].some((option) => option === action);

Expand Down

0 comments on commit c5c3c45

Please sign in to comment.