Skip to content

Commit

Permalink
Fix minor errors
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejkustra committed Jun 19, 2024
1 parent 1141173 commit 31f64f4
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 23 deletions.
16 changes: 8 additions & 8 deletions __mocks__/@ua/react-native-airship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ const iOS: Partial<typeof AirshipIOS> = {
},
};

const pushIOS: AirshipPushIOS = jest.fn().mockImplementation(() => ({
const pushIOS = jest.fn().mockImplementation(() => ({
setBadgeNumber: jest.fn(),
setForegroundPresentationOptions: jest.fn(),
setForegroundPresentationOptionsCallback: jest.fn(),
}))();
}))() as AirshipPushIOS;

const pushAndroid: AirshipPushAndroid = jest.fn().mockImplementation(() => ({
const pushAndroid = jest.fn().mockImplementation(() => ({
setForegroundDisplayPredicate: jest.fn(),
}))();
}))() as AirshipPushAndroid;

const push: AirshipPush = jest.fn().mockImplementation(() => ({
const push = jest.fn().mockImplementation(() => ({
iOS: pushIOS,
android: pushAndroid,
enableUserNotifications: () => Promise.resolve(false),
clearNotifications: jest.fn(),
getNotificationStatus: () => Promise.resolve({airshipOptIn: false, systemEnabled: false, airshipEnabled: false}),
getActiveNotifications: () => Promise.resolve([]),
}))();
}))() as AirshipPush;

const contact: AirshipContact = jest.fn().mockImplementation(() => ({
const contact = jest.fn().mockImplementation(() => ({
identify: jest.fn(),
getNamedUserId: () => Promise.resolve(undefined),
reset: jest.fn(),
module: jest.fn(),
}))();
}))() as AirshipContact;

const Airship: Partial<AirshipRoot> = {
addListener: jest.fn(),
Expand Down
1 change: 1 addition & 0 deletions __mocks__/fs.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
const {fs} = require('memfs');

module.exports = fs;
4 changes: 2 additions & 2 deletions __mocks__/react-native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jest.doMock('react-native', () => {
};
};

const reactNativeMock: ReactNativeMock = Object.setPrototypeOf(
const reactNativeMock = Object.setPrototypeOf(
{
NativeModules: {
...ReactNative.NativeModules,
Expand Down Expand Up @@ -102,7 +102,7 @@ jest.doMock('react-native', () => {
},
},
ReactNative,
);
) as ReactNativeMock;

return reactNativeMock;
});
2 changes: 1 addition & 1 deletion desktop/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const manuallyCheckForUpdates = (menuItem?: MenuItem, browserWindow?: BrowserWin

autoUpdater
.checkForUpdates()
.catch((error) => {
.catch((error: Error) => {
isSilentUpdating = false;
return {error};
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/OfflineWithFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function OfflineWithFeedback({
return child;
}

const childProps: {children: React.ReactNode | undefined; style: AllStyles} = child.props;
const childProps = child.props as {children: React.ReactNode | undefined; style: AllStyles};
const props: StrikethroughProps = {
style: StyleUtils.combineStyles(childProps.style, styles.offlineFeedback.deleted, styles.userSelectNone),
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tooltip/PopoverAnchorTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function PopoverAnchorTooltip({shouldRender = true, children, ...props}: Tooltip

const isPopoverRelatedToTooltipOpen = useMemo(() => {
// eslint-disable-next-line @typescript-eslint/dot-notation
const tooltipNode: Node | null = tooltipRef.current?.['_childNode'] ?? null;
const tooltipNode = (tooltipRef.current?.['_childNode'] as Node) ?? null;

if (
isOpen &&
Expand Down
2 changes: 1 addition & 1 deletion src/libs/E2E/utils/NetworkInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function getFetchRequestHeadersAsObject(fetchRequest: RequestInit): Record<strin
});
} else if (typeof fetchRequest.headers === 'object') {
Object.entries(fetchRequest.headers).forEach(([key, value]) => {
headers[key] = value;
headers[key] = value as string;
});
}
return headers;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/linkTo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam

// If action type is different than NAVIGATE we can't change it to the PUSH safely
if (action?.type === CONST.NAVIGATION.ACTION_TYPE.NAVIGATE) {
const actionParams: ActionPayloadParams = action.payload.params;
const actionParams = action.payload.params as ActionPayloadParams;
const topRouteName = rootState?.routes?.at(-1)?.name;
const isTargetNavigatorOnTop = topRouteName === action.payload.name;

Expand Down
4 changes: 2 additions & 2 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ function sortCategories(categories: Record<string, Category>): Category[] {
const sortedCategories = Object.values(categories).sort((a, b) => a.name.localeCompare(b.name));

// An object that respects nesting of categories. Also, can contain only uniq categories.
const hierarchy = {};
const hierarchy: Hierarchy = {};
/**
* Iterates over all categories to set each category in a proper place in hierarchy
* It gets a path based on a category name e.g. "Parent: Child: Subcategory" -> "Parent.Child.Subcategory".
Expand All @@ -978,7 +978,7 @@ function sortCategories(categories: Record<string, Category>): Category[] {
*/
sortedCategories.forEach((category) => {
const path = category.name.split(CONST.PARENT_CHILD_SEPARATOR);
const existedValue = lodashGet(hierarchy, path, {});
const existedValue = lodashGet(hierarchy, path, {}) as Hierarchy;
lodashSet(hierarchy, path, {
...existedValue,
name: category.name,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ function authenticatePusher(socketID: string, channelName: string, callback: Cha
Log.info('[PusherAuthorizer] Pusher authenticated successfully', false, {channelName});
callback(null, response as ChannelAuthorizationData);
})
.catch((error) => {
.catch((error: Error) => {
Log.hmmm('[PusherAuthorizer] Unhandled error: ', {channelName, error});
callback(new Error('AuthenticatePusher request failed'), {auth: ''});
});
Expand Down
2 changes: 1 addition & 1 deletion src/libs/fileDownload/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function downloadVideo(fileUrl: string, fileName: string): Promise<PhotoIdentifi
// Because CameraRoll doesn't allow direct downloads of video with remote URIs, we first download as documents, then copy to photo lib and unlink the original file.
downloadFile(fileUrl, fileName)
.then((attachment) => {
documentPathUri = attachment.data;
documentPathUri = attachment.data as string | null;
if (!documentPathUri) {
throw new Error('Error downloading video');
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Wallet/ExpensifyCardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function ExpensifyCardPage({
[revealedCardID]: '',
}));
})
.catch((error) => {
.catch((error: string) => {
setCardsDetailsErrors((prevState) => ({
...prevState,
[revealedCardID]: error,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/createProxyForObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const createProxyForObject = <Value extends Record<string, unknown>>(value: Valu

return target[property];
},
set: (target, property, newValue) => {
set: (target, property, newValue: Value[string]) => {
if (typeof property === 'symbol') {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/perf-test/ReportActionsUtils.perf-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const getMockedReportActionsMap = (reportsLength = 10, actionsPerReportLength =
const reportKeysMap = Array.from({length: reportsLength}, (v, i) => {
const key = i + 1;

return {[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${key}`]: Object.assign({}, ...mockReportActions)};
return {[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${key}`]: Object.assign({}, ...mockReportActions) as Partial<ReportAction>};
});

return Object.assign({}, ...reportKeysMap) as Partial<ReportAction>;
};

const mockedReportActionsMap = getMockedReportActionsMap(2, 10000);
const mockedReportActionsMap: Partial<ReportAction> = getMockedReportActionsMap(2, 10000);

const reportActions = createCollection<ReportAction>(
(item) => `${item.reportActionID}`,
Expand Down

0 comments on commit 31f64f4

Please sign in to comment.