Skip to content

Commit

Permalink
Merge pull request Expensify#37186 from Expensify/Rory-FixTypecheckOn…
Browse files Browse the repository at this point in the history
…Main
  • Loading branch information
roryabraham authored Feb 25, 2024
2 parents 8bdb753 + 1ceaddf commit 56bda00
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
5 changes: 3 additions & 2 deletions src/components/AvatarWithImagePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import * as Browser from '@libs/Browser';
import type {CustomRNImageManipulatorResult} from '@libs/cropOrRotateImage/types';
import * as FileUtils from '@libs/fileDownload/FileUtils';
import getImageResolution from '@libs/fileDownload/getImageResolution';
import type {AvatarSource} from '@libs/UserUtils';
Expand Down Expand Up @@ -54,7 +55,7 @@ type AvatarWithImagePickerProps = {
disabledStyle?: StyleProp<ViewStyle>;

/** Executed once an image has been selected */
onImageSelected?: () => void;
onImageSelected?: (file: File | CustomRNImageManipulatorResult) => void;

/** Execute when the user taps "remove" */
onImageRemoved?: () => void;
Expand Down Expand Up @@ -87,7 +88,7 @@ type AvatarWithImagePickerProps = {
pendingAction?: OnyxCommon.PendingAction;

/** The errors to display */
errors?: OnyxCommon.Errors;
errors?: OnyxCommon.Errors | null;

/** Title for avatar preview modal */
headerTitle?: string;
Expand Down
13 changes: 6 additions & 7 deletions src/pages/workspace/WorkspaceProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {CurrencyList} from '@src/types/onyx';
import type * as OnyxCommon from '@src/types/onyx/OnyxCommon';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import withPolicy from './withPolicy';
import type {WithPolicyProps} from './withPolicy';
Expand Down Expand Up @@ -102,11 +101,11 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi
fallbackIcon={Expensicons.FallbackWorkspaceAvatar}
style={[styles.mb3, isSmallScreenWidth ? styles.mtn17 : styles.mtn20, styles.alignItemsStart, styles.sectionMenuItemTopDescription]}
isUsingDefaultAvatar={!policy?.avatar ?? null}
onImageSelected={(file: File) => Policy.updateWorkspaceAvatar(policy?.id ?? '', file)}
onImageSelected={(file) => Policy.updateWorkspaceAvatar(policy?.id ?? '', file as File)}
onImageRemoved={() => Policy.deleteWorkspaceAvatar(policy?.id ?? '')}
editorMaskImage={Expensicons.ImageCropSquareMask}
pendingAction={policy?.pendingFields?.avatar ?? null}
errors={policy?.errorFields?.avatar ?? null}
pendingAction={policy?.pendingFields?.avatar}
errors={policy?.errorFields?.avatar}
onErrorClose={() => Policy.clearAvatarErrors(policy?.id ?? '')}
previewSource={UserUtils.getFullSizeAvatar(policy?.avatar ?? '')}
headerTitle={translate('workspace.common.workspaceAvatar')}
Expand All @@ -115,7 +114,7 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi
disabledStyle={styles.cursorDefault}
errorRowStyles={undefined}
/>
<OfflineWithFeedback pendingAction={policy?.pendingFields?.generalSettings as OnyxCommon.PendingAction}>
<OfflineWithFeedback pendingAction={policy?.pendingFields?.generalSettings}>
<MenuItemWithTopDescription
title={policyName}
titleStyle={styles.workspaceTitleStyle}
Expand All @@ -129,7 +128,7 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi
/>
</OfflineWithFeedback>
{(!StringUtils.isEmptyString(policy?.description ?? '') || !readOnly) && (
<OfflineWithFeedback pendingAction={policy?.pendingFields?.description as OnyxCommon.PendingAction}>
<OfflineWithFeedback pendingAction={policy?.pendingFields?.description}>
<MenuItemWithTopDescription
title={policyDescription}
description={translate('workspace.editor.descriptionInputLabel')}
Expand All @@ -143,7 +142,7 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi
/>
</OfflineWithFeedback>
)}
<OfflineWithFeedback pendingAction={policy?.pendingFields?.generalSettings as OnyxCommon.PendingAction}>
<OfflineWithFeedback pendingAction={policy?.pendingFields?.generalSettings}>
<View>
<MenuItemWithTopDescription
title={formattedCurrency}
Expand Down
5 changes: 2 additions & 3 deletions src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSection
import * as Policy from '@userActions/Policy';
import CONST from '@src/CONST';
import type SCREENS from '@src/SCREENS';
import type {PendingAction} from '@src/types/onyx/OnyxCommon';
import ToggleSettingOptionRow from './ToggleSettingsOptionRow';
import type {ToggleSettingOptionRowProps} from './ToggleSettingsOptionRow';

Expand Down Expand Up @@ -60,7 +59,7 @@ function WorkspaceWorkflowsPage({policy, route}: WorkspaceWorkflowsPageProps) {
/>
),
isActive: policy?.harvesting?.enabled ?? false,
pendingAction: policy?.pendingFields?.isAutoApprovalEnabled as PendingAction,
pendingAction: policy?.pendingFields?.isAutoApprovalEnabled,
},
{
icon: Illustrations.Approval,
Expand All @@ -83,7 +82,7 @@ function WorkspaceWorkflowsPage({policy, route}: WorkspaceWorkflowsPageProps) {
/>
),
isActive: policy?.isAutoApprovalEnabled ?? false,
pendingAction: policy?.pendingFields?.approvalMode as PendingAction,
pendingAction: policy?.pendingFields?.approvalMode,
},
{
icon: Illustrations.WalletAlt,
Expand Down
2 changes: 1 addition & 1 deletion src/types/onyx/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ type Policy = {
makeMeAdmin?: boolean;

/** Pending fields for the policy */
pendingFields?: Record<string, unknown>;
pendingFields?: Record<string, OnyxCommon.PendingAction>;

/** Original file name which is used for the policy avatar */
originalFileName?: string;
Expand Down

0 comments on commit 56bda00

Please sign in to comment.