Skip to content

Commit

Permalink
fix: more errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Pader committed Jan 3, 2024
1 parent 82b76c1 commit 19eb210
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {ForwardedRef} from 'react';
import React, { forwardRef, useCallback, useEffect, useMemo} from 'react';
// eslint-disable-next-line no-restricted-imports
import React, {forwardRef, useCallback, useEffect, useMemo} from 'react';
import type {GestureResponderEvent, View} from 'react-native';
import { Pressable} from 'react-native';
// eslint-disable-next-line no-restricted-imports
import {Pressable} from 'react-native';
import useSingleExecution from '@hooks/useSingleExecution';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useSafeAreaInsets/index.android.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line no-restricted-imports
import type {EdgeInsets} from 'react-native-safe-area-context';
import { useSafeAreaInsets as useSafeAreaInsetsInternal} from 'react-native-safe-area-context';
// eslint-disable-next-line no-restricted-imports
import {useSafeAreaInsets as useSafeAreaInsetsInternal} from 'react-native-safe-area-context';
import StatusBar from '@libs/StatusBar';

function useSafeAreaInsets(): EdgeInsets {
Expand Down
7 changes: 3 additions & 4 deletions src/libs/CardUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Onyx from 'react-native-onyx';
import CONST from '@src/CONST';
import type {OnyxValues} from '@src/ONYXKEYS';
import ONYXKEYS from '@src/ONYXKEYS';
import type * as OnyxTypes from '@src/types/onyx';
import type {Card} from '@src/types/onyx';
import * as Localize from './Localize';

Expand Down Expand Up @@ -73,10 +72,10 @@ function getYearFromExpirationDateString(expirationDateString: string) {
* @param cardList - collection of assigned cards
* @returns collection of assigned cards grouped by domain
*/
function getDomainCards(cardList: Record<string, OnyxTypes.Card>) {
function getDomainCards(cardList: Record<string, Card>) {
// Check for domainName to filter out personal credit cards.
// eslint-disable-next-line you-dont-need-lodash-underscore/filter
const activeCards = lodash.filter(cardList, (card) => !!card.domainName && (CONST.EXPENSIFY_CARD.ACTIVE_STATES as ReadonlyArray<OnyxTypes.Card['state']>).includes(card.state));
const activeCards = lodash.filter(cardList, (card) => !!card.domainName && (CONST.EXPENSIFY_CARD.ACTIVE_STATES as ReadonlyArray<Card['state']>).includes(card.state));
return lodash.groupBy(activeCards, (card) => card.domainName);
}

Expand Down Expand Up @@ -113,7 +112,7 @@ function findPhysicalCard(cards: Card[]) {
*
* @param cardList - collection of assigned cards
*/
function hasDetectedFraud(cardList: Record<string, OnyxTypes.Card>): boolean {
function hasDetectedFraud(cardList: Record<string, Card>): boolean {
return Object.values(cardList).some((card) => card.fraud !== CONST.EXPENSIFY_CARD.FRAUD_TYPES.NONE);
}

Expand Down
15 changes: 7 additions & 8 deletions src/libs/PersonalDetailsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import type {OnyxEntry} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type * as OnyxTypes from '@src/types/onyx';
import type {PersonalDetails, PersonalDetailsList} from '@src/types/onyx';
import type {PersonalDetails, PersonalDetailsList, PrivatePersonalDetails} from '@src/types/onyx';
import * as LocalePhoneNumber from './LocalePhoneNumber';
import * as Localize from './Localize';
import * as UserUtils from './UserUtils';

let personalDetails: Array<OnyxTypes.PersonalDetails | null> = [];
let personalDetails: Array<PersonalDetails | null> = [];
let allPersonalDetails: OnyxEntry<PersonalDetailsList> = {};
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
Expand All @@ -31,11 +30,11 @@ function getDisplayNameOrDefault(passedPersonalDetails?: Partial<PersonalDetails
* @param shouldChangeUserDisplayName - It will replace the current user's personal detail object's displayName with 'You'.
* @returns - Array of personal detail objects
*/
function getPersonalDetailsByIDs(accountIDs: number[], currentUserAccountID: number, shouldChangeUserDisplayName = false): OnyxTypes.PersonalDetails[] {
const result: OnyxTypes.PersonalDetails[] = accountIDs
function getPersonalDetailsByIDs(accountIDs: number[], currentUserAccountID: number, shouldChangeUserDisplayName = false): PersonalDetails[] {
const result: PersonalDetails[] = accountIDs
.filter((accountID) => !!allPersonalDetails?.[accountID])
.map((accountID) => {
const detail = (allPersonalDetails?.[accountID] ?? {}) as OnyxTypes.PersonalDetails;
const detail = (allPersonalDetails?.[accountID] ?? {}) as PersonalDetails;

if (shouldChangeUserDisplayName && currentUserAccountID === detail.accountID) {
return {
Expand Down Expand Up @@ -77,7 +76,7 @@ function getAccountIDsByLogins(logins: string[]): number[] {
*/
function getLoginsByAccountIDs(accountIDs: number[]): string[] {
return accountIDs.reduce((foundLogins: string[], accountID) => {
const currentDetail: Partial<OnyxTypes.PersonalDetails> = personalDetails.find((detail) => Number(detail?.accountID) === Number(accountID)) ?? {};
const currentDetail: Partial<PersonalDetails> = personalDetails.find((detail) => Number(detail?.accountID) === Number(accountID)) ?? {};
if (currentDetail.login) {
foundLogins.push(currentDetail.login);
}
Expand Down Expand Up @@ -177,7 +176,7 @@ function getStreetLines(street = '') {
* @param privatePersonalDetails - details object
* @returns - formatted address
*/
function getFormattedAddress(privatePersonalDetails: OnyxTypes.PrivatePersonalDetails): string {
function getFormattedAddress(privatePersonalDetails: PrivatePersonalDetails): string {
const {address} = privatePersonalDetails;
const [street1, street2] = getStreetLines(address?.street);
const formattedAddress =
Expand Down

0 comments on commit 19eb210

Please sign in to comment.