Skip to content

Commit

Permalink
Merge pull request #34956 from software-mansion-labs/@szymczak/RoomIn…
Browse files Browse the repository at this point in the history
…vitePage

[TS migration] Migrate RoomInvitePage to typescript
  • Loading branch information
aldo-expensify authored Feb 13, 2024
2 parents e1f6b13 + 2870cdf commit e90415d
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 134 deletions.
4 changes: 3 additions & 1 deletion src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ type RoomMembersNavigatorParamList = {
};

type RoomInviteNavigatorParamList = {
[SCREENS.ROOM_INVITE_ROOT]: undefined;
[SCREENS.ROOM_INVITE_ROOT]: {
reportID: string;
};
};

type MoneyRequestNavigatorParamList = {
Expand Down
22 changes: 7 additions & 15 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import lodashGet from 'lodash/get';
import lodashOrderBy from 'lodash/orderBy';
import lodashSet from 'lodash/set';
import lodashSortBy from 'lodash/sortBy';
import type {ReactElement} from 'react';
import Onyx from 'react-native-onyx';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -122,11 +121,11 @@ type MemberForList = {
keyForList: string;
isSelected: boolean;
isDisabled: boolean;
accountID?: number;
accountID?: number | null;
login: string;
rightElement: ReactElement | null;
icons?: OnyxCommon.Icon[];
pendingAction?: OnyxCommon.PendingAction;
reportID: string;
};

type SectionForSearchTerm = {
Expand Down Expand Up @@ -1837,14 +1836,8 @@ function getShareDestinationOptions(
* @param member - personalDetails or userToInvite
* @param config - keys to overwrite the default values
*/
function formatMemberForList(member: ReportUtils.OptionData, config?: Partial<MemberForList>): MemberForList;
function formatMemberForList(member: null | undefined, config?: Partial<MemberForList>): undefined;
function formatMemberForList(member: ReportUtils.OptionData | null | undefined, config: Partial<MemberForList> = {}): MemberForList | undefined {
if (!member) {
return undefined;
}

const accountID = member.accountID ?? undefined;
function formatMemberForList(member: ReportUtils.OptionData): MemberForList {
const accountID = member.accountID;

return {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Expand All @@ -1853,14 +1846,13 @@ function formatMemberForList(member: ReportUtils.OptionData | null | undefined,
alternateText: member.alternateText || member.login || '',
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
keyForList: member.keyForList || String(accountID ?? 0) || '',
isSelected: false,
isDisabled: false,
isSelected: member.isSelected ?? false,
isDisabled: member.isDisabled ?? false,
accountID,
login: member.login ?? '',
rightElement: null,
icons: member.icons,
pendingAction: member.pendingAction,
...config,
reportID: member.reportID,
};
}

Expand Down
2 changes: 2 additions & 0 deletions src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,5 @@ export {
getPathWithoutPolicyID,
getPolicyMembersByIdWithoutCurrentUser,
};

export type {MemberEmailsToAccountIDs};
Loading

0 comments on commit e90415d

Please sign in to comment.