Skip to content

Commit

Permalink
fix: types in util files
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszGrajdek committed Dec 18, 2023
1 parent 24f5eb2 commit 40d8204
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1458,12 +1458,12 @@ function getDisplayNamesWithTooltips(

return personalDetailsListArray
.map((user) => {
const accountID = Number(user.accountID);
const accountID = Number(user?.accountID);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const displayName = getDisplayNameForParticipant(accountID, isMultipleParticipantReport, shouldFallbackToHidden) || user.login || '';
const displayName = getDisplayNameForParticipant(accountID, isMultipleParticipantReport, shouldFallbackToHidden) || user?.login || '';
const avatar = UserUtils.getDefaultAvatar(accountID);

let pronouns = user.pronouns;
let pronouns = user?.pronouns ?? '';
if (pronouns?.startsWith(CONST.PRONOUNS.PREFIX)) {
const pronounTranslationKey = pronouns.replace(CONST.PRONOUNS.PREFIX, '');
pronouns = Localize.translateLocal(`pronouns.${pronounTranslationKey}` as TranslationPaths);
Expand All @@ -1472,7 +1472,7 @@ function getDisplayNamesWithTooltips(
return {
displayName,
avatar,
login: user.login ?? '',
login: user?.login ?? '',
accountID,
pronouns,
};
Expand Down
4 changes: 2 additions & 2 deletions src/libs/UserUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as defaultAvatars from '@components/Icon/DefaultAvatars';
import {ConciergeAvatar, FallbackAvatar} from '@components/Icon/Expensicons';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import {PersonalDetails} from '@src/types/onyx';
import {PersonalDetailsList} from '@src/types/onyx';
import Login from '@src/types/onyx/Login';
import hashCode from './hashCode';

Expand All @@ -17,7 +17,7 @@ type AvatarSource = React.FC<SvgProps> | string;

type LoginListIndicator = ValueOf<typeof CONST.BRICK_ROAD_INDICATOR_STATUS> | '';

let allPersonalDetails: OnyxEntry<Record<string, PersonalDetails>>;
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (val) => (allPersonalDetails = _.isEmpty(val) ? {} : val),
Expand Down

0 comments on commit 40d8204

Please sign in to comment.