From f707179ebd99de51b5ba7fdb3baec1f22776419f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Mon, 27 May 2024 18:56:35 +0200 Subject: [PATCH 01/27] update package --- package-lock.json | 21 ++++----------------- package.json | 2 +- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index bad61d4704bc..4b0c73759da8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -208,7 +208,7 @@ "electron-builder": "24.13.2", "eslint": "^7.6.0", "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-config-expensify": "^2.0.47", + "eslint-config-expensify": "^2.0.49", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", @@ -1855,19 +1855,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-object-assign": { - "version": "7.18.6", - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-object-rest-spread": { "version": "7.24.1", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.1.tgz", @@ -19379,9 +19366,9 @@ } }, "node_modules/eslint-config-expensify": { - "version": "2.0.48", - "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.48.tgz", - "integrity": "sha512-PFegJ9Wfsiu5tgevhjA1toCxsZ8Etfk6pIjtXAnwpmVj7q4CtB3QDRusJoUDyJ3HrZr8AsFKViz7CU/CBTfwOw==", + "version": "2.0.49", + "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.49.tgz", + "integrity": "sha512-3yGQuOsjvtWh/jYSJKIJgmwULhrVMCiYkWGzLOKpm/wCzdiP4l0T/gJMWOkvGhTtyqxsP7ZUTwPODgcE3extxA==", "dev": true, "dependencies": { "@lwc/eslint-plugin-lwc": "^1.7.2", diff --git a/package.json b/package.json index 6f40533fea37..ee83a349b9ab 100644 --- a/package.json +++ b/package.json @@ -260,7 +260,7 @@ "electron-builder": "24.13.2", "eslint": "^7.6.0", "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-config-expensify": "^2.0.47", + "eslint-config-expensify": "^2.0.49", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", From 71b2413654d8b40a9c2420da92940e12fca26728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Mon, 27 May 2024 19:28:17 +0200 Subject: [PATCH 02/27] fix react-native-permissions --- __mocks__/react-native-permissions.ts | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/__mocks__/react-native-permissions.ts b/__mocks__/react-native-permissions.ts index 67b7db830d94..d98b7f32a611 100644 --- a/__mocks__/react-native-permissions.ts +++ b/__mocks__/react-native-permissions.ts @@ -35,30 +35,30 @@ const requestNotifications: jest.Mock = jest.fn((options: Record notificationOptions.includes(option)) - .reduce((acc: NotificationSettings, option: string) => ({...acc, [option]: true}), { - lockScreen: true, - notificationCenter: true, - }), + .reduce( + (acc: NotificationSettings, option: string) => { + acc[option] = true; + return acc; + }, + { + lockScreen: true, + notificationCenter: true, + }, + ), })); const checkMultiple: jest.Mock = jest.fn((permissions: string[]) => - permissions.reduce( - (acc: ResultsCollection, permission: string) => ({ - ...acc, - [permission]: RESULTS.GRANTED, - }), - {}, - ), + permissions.reduce((acc: ResultsCollection, permission: string) => { + acc[permission] = RESULTS.GRANTED; + return acc; + }, {}), ); const requestMultiple: jest.Mock = jest.fn((permissions: string[]) => - permissions.reduce( - (acc: ResultsCollection, permission: string) => ({ - ...acc, - [permission]: RESULTS.GRANTED, - }), - {}, - ), + permissions.reduce((acc: ResultsCollection, permission: string) => { + acc[permission] = RESULTS.GRANTED; + return acc; + }, {}), ); export { From 86e68f07916453ec98885f3e99f42dbe4b839b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Mon, 27 May 2024 19:38:31 +0200 Subject: [PATCH 03/27] fix TransactionUtils --- src/libs/TransactionUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/TransactionUtils.ts b/src/libs/TransactionUtils.ts index 46d37c54f087..66e3100e7ccd 100644 --- a/src/libs/TransactionUtils.ts +++ b/src/libs/TransactionUtils.ts @@ -605,12 +605,12 @@ function getValidWaypoints(waypoints: WaypointCollection | undefined, reArrangeI return acc; } - const validatedWaypoints: WaypointCollection = {...acc, [`waypoint${reArrangeIndexes ? waypointIndex + 1 : index}`]: currentWaypoint}; + acc[`waypoint${reArrangeIndexes ? waypointIndex + 1 : index}`] = currentWaypoint; lastWaypointIndex = index; waypointIndex += 1; - return validatedWaypoints; + return acc; }, {}); } From 16f9639a67dafc46a6691ae076a5b191c1400c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Mon, 27 May 2024 19:44:09 +0200 Subject: [PATCH 04/27] fix DeferredOnyxUpdates --- .../OnyxUpdateManager/utils/DeferredOnyxUpdates.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts b/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts index 451de2ed8a5c..8a7b67db30c6 100644 --- a/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts @@ -39,13 +39,12 @@ function getUpdates(options?: GetDeferredOnyxUpdatesOptiosn) { return deferredUpdates; } - return Object.entries(deferredUpdates).reduce( - (accUpdates, [lastUpdateID, update]) => ({ - ...accUpdates, - ...(Number(lastUpdateID) > (options.minUpdateID ?? 0) ? {[Number(lastUpdateID)]: update} : {}), - }), - {}, - ); + return Object.entries(deferredUpdates).reduce((acc, [lastUpdateID, update]) => { + if (Number(lastUpdateID) > (options.minUpdateID ?? 0)) { + acc[Number(lastUpdateID)] = update; + } + return acc; + }, {}); } /** From c83262db310632619d8a4544ce60639b3f3aebe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Mon, 27 May 2024 19:45:28 +0200 Subject: [PATCH 05/27] fix OnyxUpdateManager --- src/libs/actions/OnyxUpdateManager/utils/index.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/libs/actions/OnyxUpdateManager/utils/index.ts b/src/libs/actions/OnyxUpdateManager/utils/index.ts index be062b1e0921..ffc8cbd989df 100644 --- a/src/libs/actions/OnyxUpdateManager/utils/index.ts +++ b/src/libs/actions/OnyxUpdateManager/utils/index.ts @@ -67,14 +67,12 @@ function detectGapsAndSplit(updates: DeferredUpdatesDictionary, clientLastUpdate let updatesAfterGaps: DeferredUpdatesDictionary = {}; if (gapExists) { - updatesAfterGaps = Object.entries(updates).reduce( - (accUpdates, [lastUpdateID, update]) => ({ - ...accUpdates, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - ...(Number(lastUpdateID) >= firstUpdateAfterGapWithFallback ? {[Number(lastUpdateID)]: update} : {}), - }), - {}, - ); + updatesAfterGaps = Object.entries(updates).reduce((acc, [lastUpdateID, update]) => { + if (Number(lastUpdateID) >= firstUpdateAfterGapWithFallback) { + acc[Number(lastUpdateID)] = update; + } + return acc; + }, {}); } return {applicableUpdates, updatesAfterGaps, latestMissingUpdateID}; From 36ebdda4534e32106871f127da66158bbd1d3a0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 09:18:54 +0200 Subject: [PATCH 06/27] fix Report --- src/libs/actions/Report.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index c9ff3c485198..cdcbff793082 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3167,8 +3167,7 @@ function completeOnboarding( })); const tasksForOptimisticData = tasksData.reduce((acc, {currentTask, taskCreatedAction, taskReportAction, taskDescription, completedTaskReportAction}) => { - const tasksForOptimisticDataAcc: OnyxUpdate[] = [ - ...acc, + acc.push( { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`, @@ -3198,10 +3197,10 @@ function completeOnboarding( [taskCreatedAction.reportActionID]: taskCreatedAction as ReportAction, }, }, - ]; + ); if (completedTaskReportAction) { - tasksForOptimisticDataAcc.push({ + acc.push({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${currentTask.reportID}`, value: { @@ -3209,7 +3208,7 @@ function completeOnboarding( }, }); - tasksForOptimisticDataAcc.push({ + acc.push({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${currentTask.reportID}`, value: { @@ -3219,12 +3218,11 @@ function completeOnboarding( }); } - return tasksForOptimisticDataAcc; + return acc; }, []); const tasksForFailureData = tasksData.reduce((acc, {currentTask, taskReportAction}) => { - const tasksForFailureDataAcc: OnyxUpdate[] = [ - ...acc, + acc.push( { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`, @@ -3244,9 +3242,9 @@ function completeOnboarding( key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${currentTask.reportID}`, value: null, }, - ]; + ); - return tasksForFailureDataAcc; + return acc; }, []); const optimisticData: OnyxUpdate[] = [ From 41ef7c4d0d5a9a52bff6cb8d374424cc89f98828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 09:22:59 +0200 Subject: [PATCH 07/27] RenameCardIsVirtual --- src/libs/migrations/RenameCardIsVirtual.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libs/migrations/RenameCardIsVirtual.ts b/src/libs/migrations/RenameCardIsVirtual.ts index 5929b39dfe72..751c11d70eac 100644 --- a/src/libs/migrations/RenameCardIsVirtual.ts +++ b/src/libs/migrations/RenameCardIsVirtual.ts @@ -26,20 +26,20 @@ export default function () { } Log.info('[Migrate Onyx] Running RenameCardIsVirtual migration'); - const dataToSave: Record> = cardsWithIsVirtualProp.reduce((result, card) => { + const dataToSave = cardsWithIsVirtualProp.reduce((acc, card) => { if (!card) { - return result; + return acc; } - return { - ...result, - [card.cardID]: { - nameValuePairs: { - isVirtual: card?.nameValuePairs?.isVirtual, - }, - isVirtual: undefined, + + acc[card.cardID] = { + nameValuePairs: { + isVirtual: card?.nameValuePairs?.isVirtual, }, + isVirtual: undefined, }; - }, {}); + + return acc; + }, {} as Record>); // eslint-disable-next-line rulesdir/prefer-actions-set-data Onyx.merge(ONYXKEYS.CARD_LIST, dataToSave).then(() => { From 36b4b575ccd26802fefe7d62ceea51798ce75960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 09:25:42 +0200 Subject: [PATCH 08/27] RenameReceiptFilename --- src/libs/migrations/RenameReceiptFilename.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/libs/migrations/RenameReceiptFilename.ts b/src/libs/migrations/RenameReceiptFilename.ts index 100b279c950f..f01676595dd7 100644 --- a/src/libs/migrations/RenameReceiptFilename.ts +++ b/src/libs/migrations/RenameReceiptFilename.ts @@ -30,19 +30,17 @@ export default function () { return resolve(); } Log.info('[Migrate Onyx] Running RenameReceiptFilename migration'); - const dataToSave: Record> = transactionsWithReceipt?.reduce((result, transaction) => { + const dataToSave = transactionsWithReceipt?.reduce((acc, transaction) => { if (!transaction) { - return result; + return acc; } Log.info(`[Migrate Onyx] Renaming receiptFilename ${transaction.receiptFilename} to filename`); - return { - ...result, - [`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`]: { - filename: transaction.receiptFilename, - receiptFilename: null, - }, + acc[`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`] = { + filename: transaction.receiptFilename, + receiptFilename: null, }; - }, {}); + return acc; + }, {} as Record>); // eslint-disable-next-line rulesdir/prefer-actions-set-data Onyx.mergeCollection(ONYXKEYS.COLLECTION.TRANSACTION, dataToSave).then(() => { From 8eb1b9aec6608c5d67ad51e6e3ba046bf0935e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 10:03:44 +0200 Subject: [PATCH 09/27] fix getSubstepValues --- src/pages/EnablePayments/utils/getSubstepValues.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/pages/EnablePayments/utils/getSubstepValues.ts b/src/pages/EnablePayments/utils/getSubstepValues.ts index d1fdda5fcbc1..2eb80ed1b2ee 100644 --- a/src/pages/EnablePayments/utils/getSubstepValues.ts +++ b/src/pages/EnablePayments/utils/getSubstepValues.ts @@ -7,14 +7,11 @@ function getSubstepValues( inputKeys: Record, walletAdditionalDetailsDraft: OnyxEntry, walletAdditionalDetails: OnyxEntry, -): {[K in T]: WalletAdditionalDetailsForm[K]} { - return Object.entries(inputKeys).reduce( - (acc, [, value]) => ({ - ...acc, - [value]: walletAdditionalDetailsDraft?.[value] ?? walletAdditionalDetails?.[value as keyof PersonalInfoStepProps] ?? '', - }), - {} as {[K in T]: WalletAdditionalDetailsForm[K]}, - ); +): {[K in T]: WalletAdditionalDetailsForm[K] | string} { + return Object.entries(inputKeys).reduce((acc, [, value]) => { + acc[value] = walletAdditionalDetailsDraft?.[value] ?? walletAdditionalDetails?.[value as keyof PersonalInfoStepProps] ?? ''; + return acc; + }, {} as {[K in T]: WalletAdditionalDetailsForm[K] | string}); } export default getSubstepValues; From 25983d7d5e462a8d6532d546e7dcd1a9874108ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 10:15:05 +0200 Subject: [PATCH 10/27] fix BeneficialOwnersStep --- .../ReimbursementAccount/BeneficialOwnersStep.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/pages/ReimbursementAccount/BeneficialOwnersStep.tsx b/src/pages/ReimbursementAccount/BeneficialOwnersStep.tsx index 10b05e58deb7..393846413a27 100644 --- a/src/pages/ReimbursementAccount/BeneficialOwnersStep.tsx +++ b/src/pages/ReimbursementAccount/BeneficialOwnersStep.tsx @@ -68,13 +68,10 @@ function BeneficialOwnersStep({reimbursementAccount, reimbursementAccountDraft, const submit = () => { const beneficialOwnerFields = ['firstName', 'lastName', 'dob', 'ssnLast4', 'street', 'city', 'state', 'zipCode']; const beneficialOwners = beneficialOwnerKeys.map((ownerKey) => - beneficialOwnerFields.reduce( - (acc, fieldName) => ({ - ...acc, - [fieldName]: reimbursementAccountDraft ? reimbursementAccountDraft[`beneficialOwner_${ownerKey}_${fieldName}`] : undefined, - }), - {}, - ), + beneficialOwnerFields.reduce((acc, fieldName) => { + acc[fieldName] = reimbursementAccountDraft ? reimbursementAccountDraft[`beneficialOwner_${ownerKey}_${fieldName}`] : undefined; + return acc; + }, {} as Record), ); BankAccounts.updateBeneficialOwnersForBankAccount( From dbb6be529fe486144064a10e7e2975ca31be0251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 10:22:44 +0200 Subject: [PATCH 11/27] fix WorkspaceMembersPage --- src/pages/workspace/WorkspaceMembersPage.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/pages/workspace/WorkspaceMembersPage.tsx b/src/pages/workspace/WorkspaceMembersPage.tsx index fe88c12e6776..baad0de8fd5e 100644 --- a/src/pages/workspace/WorkspaceMembersPage.tsx +++ b/src/pages/workspace/WorkspaceMembersPage.tsx @@ -99,16 +99,13 @@ function WorkspaceMembersPage({personalDetails, invitedEmailsToAccountIDsDraft, * Get filtered personalDetails list with current employeeList */ const filterPersonalDetails = (members: OnyxEntry, details: OnyxEntry): PersonalDetailsList => - Object.keys(members ?? {}).reduce((result, key) => { + Object.keys(members ?? {}).reduce((acc, key) => { const memberAccountIdKey = policyMemberEmailsToAccountIDs[key] ?? ''; if (details?.[memberAccountIdKey]) { - return { - ...result, - [memberAccountIdKey]: details[memberAccountIdKey], - }; + acc[memberAccountIdKey] = details[memberAccountIdKey]; } - return result; - }, {}); + return acc; + }, {} as PersonalDetailsList); /** * Get members for the current workspace */ From d85c1db4b7b76657db4eecf19ec9502d45fd5c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 10:27:44 +0200 Subject: [PATCH 12/27] fix TestHelper --- tests/utils/TestHelper.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/utils/TestHelper.ts b/tests/utils/TestHelper.ts index 11befebea340..832c3e8b3336 100644 --- a/tests/utils/TestHelper.ts +++ b/tests/utils/TestHelper.ts @@ -214,7 +214,12 @@ function buildTestReportComment(created: string, actorAccountID: number, actionI } function assertFormDataMatchesObject(formData: FormData, obj: Report) { - expect(Array.from(formData.entries()).reduce((memo, x) => ({...memo, [x[0]]: x[1]}), {})).toEqual(expect.objectContaining(obj)); + expect( + Array.from(formData.entries()).reduce((acc, [key, val]) => { + acc[key] = val; + return acc; + }, {} as Record), + ).toEqual(expect.objectContaining(obj)); } /** From 5f14db72d68d6ae87bca6ff102656519d62e541e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 13:28:03 +0200 Subject: [PATCH 13/27] fix Expensicons --- src/components/Icon/__mocks__/Expensicons.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Icon/__mocks__/Expensicons.ts b/src/components/Icon/__mocks__/Expensicons.ts index e268b109f0a5..b808271cd39c 100644 --- a/src/components/Icon/__mocks__/Expensicons.ts +++ b/src/components/Icon/__mocks__/Expensicons.ts @@ -3,10 +3,11 @@ import type {SvgProps} from 'react-native-svg'; const Expensicons = jest.requireActual>>('../Expensicons'); -module.exports = Object.keys(Expensicons).reduce((prev, curr) => { +module.exports = Object.keys(Expensicons).reduce((acc: Record void>, curr) => { // We set the name of the anonymous mock function here so we can dynamically build the list of mocks and access the // "name" property to use in accessibility hints for element querying const fn = () => ''; Object.defineProperty(fn, 'name', {value: curr}); - return {...prev, [curr]: fn}; + acc[curr] = fn; + return acc; }, {}); From ebea12bf21f719cc536992cddb71a747c8322e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 13:30:20 +0200 Subject: [PATCH 14/27] fix IOU --- src/libs/actions/IOU.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 6c976663dde8..9543767ffd37 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -6637,14 +6637,12 @@ function adjustRemainingSplitShares(transaction: NonNullable { + const splitShares: SplitShares = unmodifiedSharesAccountIDs.reduce((acc: SplitShares, accountID: number, index: number): SplitShares => { const splitAmount = IOUUtils.calculateAmount(unmodifiedSharesAccountIDs.length - 1, remainingTotal, transaction.currency, index === 0); - return { - ...result, - [accountID]: { - amount: splitAmount, - }, + acc[accountID] = { + amount: splitAmount, }; + return acc; }, {}); Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transaction.transactionID}`, {splitShares}); From 20867f9f8f8be779d03f3a3398859b6c32aec396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 15:34:05 +0200 Subject: [PATCH 15/27] fix fix IOU --- src/libs/actions/IOU.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 9543767ffd37..c774ca43738e 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -6564,28 +6564,24 @@ function setSplitShares(transaction: OnyxEntry, amount: n // If this is called from an existing group chat, it'll be included. So we manually add them to account for both cases. const accountIDs = [...new Set([userAccountID, ...newAccountIDs, ...oldAccountIDs])]; - const splitShares: SplitShares = accountIDs.reduce((result: SplitShares, accountID): SplitShares => { + const splitShares: SplitShares = accountIDs.reduce((acc: SplitShares, accountID): SplitShares => { // We want to replace the contents of splitShares to contain only `newAccountIDs` entries // In the case of going back to the participants page and removing a participant // a simple merge will have the previous participant still present in the splitshares object // So we manually set their entry to null if (!newAccountIDs.includes(accountID) && accountID !== userAccountID) { - return { - ...result, - [accountID]: null, - }; + acc[accountID] = null; + return acc; } const isPayer = accountID === userAccountID; const participantsLength = newAccountIDs.includes(userAccountID) ? newAccountIDs.length - 1 : newAccountIDs.length; const splitAmount = IOUUtils.calculateAmount(participantsLength, amount, currency, isPayer); - return { - ...result, - [accountID]: { - amount: splitAmount, - isModified: false, - }, + acc[accountID] = { + amount: splitAmount, + isModified: false, }; + return acc; }, {}); Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transaction.transactionID}`, {splitShares}); From 8a238775c3635f0d33c7eb60b2c06828a072ff3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 16:51:53 +0200 Subject: [PATCH 16/27] fix OptionsListUtils --- src/libs/OptionsListUtils.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 0d5854764946..a2bdc7825741 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -514,10 +514,13 @@ function getSearchText( function getAllReportErrors(report: OnyxEntry, reportActions: OnyxEntry): OnyxCommon.Errors { const reportErrors = report?.errors ?? {}; const reportErrorFields = report?.errorFields ?? {}; - const reportActionErrors: OnyxCommon.ErrorFields = Object.values(reportActions ?? {}).reduce( - (prevReportActionErrors, action) => (!action || isEmptyObject(action.errors) ? prevReportActionErrors : {...prevReportActionErrors, ...action.errors}), - {}, - ); + const reportActionErrors: OnyxCommon.ErrorFields = Object.values(reportActions ?? {}).reduce((prevReportActionErrors, action) => { + if (!action || isEmptyObject(action.errors)) { + return prevReportActionErrors; + } + + return Object.assign(prevReportActionErrors, action.errors); + }, {}); const parentReportAction: OnyxEntry = !report?.parentReportID || !report?.parentReportActionID ? null : allReportActions?.[report.parentReportID ?? '']?.[report.parentReportActionID ?? ''] ?? null; @@ -541,7 +544,13 @@ function getAllReportErrors(report: OnyxEntry, reportActions: OnyxEntry< ...reportActionErrors, }; // Combine all error messages keyed by microtime into one object - const allReportErrors = Object.values(errorSources)?.reduce((prevReportErrors, errors) => (isEmptyObject(errors) ? prevReportErrors : {...prevReportErrors, ...errors}), {}); + const allReportErrors = Object.values(errorSources)?.reduce((prevReportErrors, errors) => { + if (isEmptyObject(errors)) { + return prevReportErrors; + } + + return Object.assign(prevReportErrors, errors); + }, {}); return allReportErrors; } From c917538609e11564dcd068684becabe5e5fb33a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 17:11:40 +0200 Subject: [PATCH 17/27] fix ErrorUtils --- src/libs/ErrorUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ErrorUtils.ts b/src/libs/ErrorUtils.ts index ecaf563d59d1..8af6b706086e 100644 --- a/src/libs/ErrorUtils.ts +++ b/src/libs/ErrorUtils.ts @@ -123,7 +123,7 @@ function getLatestErrorFieldForAnyField getLatestErrorField(onyxData, fieldName)); - return latestErrorFields.reduce((acc, error) => ({...acc, ...error}), {}); + return latestErrorFields.reduce((acc, error) => Object.assign(acc, error), {}); } /** From 256ad5418a5de38fb61d0970184db60cb8a146bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 17:25:01 +0200 Subject: [PATCH 18/27] fix useStepFormSubmit --- src/hooks/useStepFormSubmit.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/hooks/useStepFormSubmit.ts b/src/hooks/useStepFormSubmit.ts index 0a0503516127..d825b12a4701 100644 --- a/src/hooks/useStepFormSubmit.ts +++ b/src/hooks/useStepFormSubmit.ts @@ -1,7 +1,8 @@ import {useCallback} from 'react'; import type {FormOnyxKeys, FormOnyxValues} from '@components/Form/types'; import * as FormActions from '@userActions/FormActions'; -import type {OnyxFormKey, OnyxFormValuesMapping} from '@src/ONYXKEYS'; +import type {OnyxFormKey, OnyxFormValuesMapping, OnyxValues} from '@src/ONYXKEYS'; +import type {BaseForm} from '@src/types/form/Form'; import type {SubStepProps} from './useSubStep/types'; type UseStepFormSubmitParams = Pick & { @@ -22,13 +23,10 @@ export default function useStepFormSubmit return useCallback( (values: FormOnyxValues) => { if (shouldSaveDraft) { - const stepValues = fieldIds.reduce( - (acc, key) => ({ - ...acc, - [key]: values[key], - }), - {}, - ); + const stepValues = fieldIds.reduce((acc, key) => { + acc[key] = values[key]; + return acc; + }, {} as Record<(typeof fieldIds)[number], OnyxValues[T][Exclude]>); FormActions.setDraftValues(formId, stepValues); } From afab89bd51197f61fee94e9f4360f61268edc24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 20:11:33 +0200 Subject: [PATCH 19/27] WIP fix getSubstepValues --- .../ReimbursementAccount/utils/getSubstepValues.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/pages/ReimbursementAccount/utils/getSubstepValues.ts b/src/pages/ReimbursementAccount/utils/getSubstepValues.ts index 8007218b41bb..442e7d72bdd9 100644 --- a/src/pages/ReimbursementAccount/utils/getSubstepValues.ts +++ b/src/pages/ReimbursementAccount/utils/getSubstepValues.ts @@ -8,13 +8,10 @@ function getSubstepValues( reimbursementAccountDraft: OnyxEntry, reimbursementAccount: OnyxEntry, ): {[K in T]: ReimbursementAccountForm[K]} { - return Object.entries(inputKeys).reduce( - (acc, [, value]) => ({ - ...acc, - [value]: reimbursementAccountDraft?.[value] ?? reimbursementAccount?.achData?.[value as keyof ACHData] ?? '', - }), - {} as {[K in T]: ReimbursementAccountForm[K]}, - ); + return Object.entries(inputKeys).reduce((acc, [, value]) => { + acc[value] = reimbursementAccountDraft?.[value] ?? reimbursementAccount?.achData?.[value as keyof ACHData] ?? ''; + return acc; + }, {} as {[K in T]: ReimbursementAccountForm[K]}); } export default getSubstepValues; From 4e2ff5e196c90375aead997a62e453aa622fdb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Tue, 28 May 2024 20:22:21 +0200 Subject: [PATCH 20/27] WIP fix Policy --- src/libs/actions/Policy.ts | 104 +++++++++++++++---------------------- 1 file changed, 43 insertions(+), 61 deletions(-) diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 533808d1ab9b..0ff60458bda4 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -95,7 +95,7 @@ import type { } from '@src/types/onyx'; import type {ErrorFields, Errors, OnyxValueWithOfflineFeedback, PendingAction} from '@src/types/onyx/OnyxCommon'; import type {OriginalMessageJoinPolicyChangeLog} from '@src/types/onyx/OriginalMessage'; -import type {Attributes, CompanyAddress, CustomUnit, Rate, Unit} from '@src/types/onyx/Policy'; +import type {Attributes, CompanyAddress, CustomUnit, Rate, TaxRate, Unit} from '@src/types/onyx/Policy'; import type {OnyxData} from '@src/types/onyx/Request'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; @@ -2115,40 +2115,31 @@ function createDraftInitialWorkspace(policyOwnerEmail = '', policyName = '', pol } function buildOptimisticPolicyCategories(policyID: string, categories: readonly string[]) { - const optimisticCategoryMap = categories.reduce( - (acc, category) => ({ - ...acc, - [category]: { - name: category, - enabled: true, - errors: null, - pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, - }, - }), - {}, - ); + const optimisticCategoryMap = categories.reduce((acc, category) => { + acc[category] = { + name: category, + enabled: true, + errors: null, + pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + }; + return acc; + }, {}); - const successCategoryMap = categories.reduce( - (acc, category) => ({ - ...acc, - [category]: { - errors: null, - pendingAction: null, - }, - }), - {}, - ); + const successCategoryMap = categories.reduce((acc, category) => { + acc[category] = { + errors: null, + pendingAction: null, + }; + return acc; + }, {}); - const failureCategoryMap = categories.reduce( - (acc, category) => ({ - ...acc, - [category]: { - errors: ErrorUtils.getMicroSecondOnyxError('workspace.categories.createFailureMessage'), - pendingAction: null, - }, - }), - {}, - ); + const failureCategoryMap = categories.reduce((acc, category) => { + acc[category] = { + errors: ErrorUtils.getMicroSecondOnyxError('workspace.categories.createFailureMessage'), + pendingAction: null, + }; + return acc; + }, {}); const onyxData: OnyxData = { optimisticData: [ @@ -2519,17 +2510,14 @@ function createDraftWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policy { onyxMethod: Onyx.METHOD.SET, key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES_DRAFT}${policyID}`, - value: CONST.POLICY.DEFAULT_CATEGORIES.reduce( - (acc, category) => ({ - ...acc, - [category]: { - name: category, - enabled: true, - errors: null, - }, - }), - {}, - ), + value: CONST.POLICY.DEFAULT_CATEGORIES.reduce((acc, category) => { + acc[category] = { + name: category, + enabled: true, + errors: null, + }; + return acc; + }, {}), }, ]; @@ -4262,16 +4250,13 @@ function enablePolicyTaxes(policyID: string, enabled: boolean) { taxRates: { ...defaultTaxRates, taxes: { - ...Object.keys(defaultTaxRates.taxes).reduce( - (prevTaxesData, taxKey) => ({ - ...prevTaxesData, - [taxKey]: { - ...defaultTaxRates.taxes[taxKey], - pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, - }, - }), - {}, - ), + ...Object.keys(defaultTaxRates.taxes).reduce((acc, taxKey) => { + acc[taxKey] = { + ...defaultTaxRates.taxes[taxKey], + pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + }; + return acc; + }, {} as Record), }, }, }, @@ -4284,13 +4269,10 @@ function enablePolicyTaxes(policyID: string, enabled: boolean) { value: { taxRates: { taxes: { - ...Object.keys(defaultTaxRates.taxes).reduce( - (prevTaxesData, taxKey) => ({ - ...prevTaxesData, - [taxKey]: {pendingAction: null}, - }), - {}, - ), + ...Object.keys(defaultTaxRates.taxes).reduce((acc, taxKey) => { + acc[taxKey] = {pendingAction: null}; + return acc; + }, {} as Record), }, }, }, From e46d13c31502b95dce295a21ae4063b2b93d9acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Wed, 29 May 2024 11:18:09 +0200 Subject: [PATCH 21/27] fix types getSubstepValues --- .../ReimbursementAccount/utils/getSubstepValues.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pages/ReimbursementAccount/utils/getSubstepValues.ts b/src/pages/ReimbursementAccount/utils/getSubstepValues.ts index 442e7d72bdd9..f89625c613f7 100644 --- a/src/pages/ReimbursementAccount/utils/getSubstepValues.ts +++ b/src/pages/ReimbursementAccount/utils/getSubstepValues.ts @@ -3,15 +3,19 @@ import type {ReimbursementAccountForm} from '@src/types/form'; import type {ReimbursementAccount} from '@src/types/onyx'; import type {ACHData} from '@src/types/onyx/ReimbursementAccount'; -function getSubstepValues( - inputKeys: Record, +type SubstepValues = { + [TKey in TProps]: ReimbursementAccountForm[TKey]; +}; + +function getSubstepValues( + inputKeys: Record, reimbursementAccountDraft: OnyxEntry, reimbursementAccount: OnyxEntry, -): {[K in T]: ReimbursementAccountForm[K]} { +): SubstepValues { return Object.entries(inputKeys).reduce((acc, [, value]) => { - acc[value] = reimbursementAccountDraft?.[value] ?? reimbursementAccount?.achData?.[value as keyof ACHData] ?? ''; + acc[value] = (reimbursementAccountDraft?.[value] ?? reimbursementAccount?.achData?.[value as keyof ACHData] ?? '') as ReimbursementAccountForm[TProps]; return acc; - }, {} as {[K in T]: ReimbursementAccountForm[K]}); + }, {} as SubstepValues); } export default getSubstepValues; From 7e4cc571195bea656fc4d72dabb9d3a8cf84818d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Wed, 29 May 2024 11:30:39 +0200 Subject: [PATCH 22/27] fix types PolicyCategory --- src/types/onyx/PolicyCategory.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/types/onyx/PolicyCategory.ts b/src/types/onyx/PolicyCategory.ts index d65d50765671..d4162bfdcddf 100644 --- a/src/types/onyx/PolicyCategory.ts +++ b/src/types/onyx/PolicyCategory.ts @@ -5,23 +5,23 @@ type PolicyCategory = OnyxCommon.OnyxValueWithOfflineFeedback<{ name: string; /** Unencoded name of a category */ - unencodedName: string; + unencodedName?: string; /** Flag that determines if a category is active and able to be selected */ enabled: boolean; /** If true, not adding a comment to a transaction with this category will trigger a violation */ - areCommentsRequired: boolean; + areCommentsRequired?: boolean; /** "General Ledger code" that corresponds to this category in an accounting system. Similar to an ID. */ // eslint-disable-next-line @typescript-eslint/naming-convention 'GL Code'?: string; /** An ID for this category from an external accounting system */ - externalID: string; + externalID?: string; /** The external accounting service that this category comes from */ - origin: string; + origin?: string; /** The old category name of the category when we edit the category name */ previousCategoryName?: string; From 2f1117467bdf81025c52810d5d0c0ff17641fa85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Wed, 29 May 2024 11:30:59 +0200 Subject: [PATCH 23/27] fix types Policy --- src/libs/actions/Policy.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 0ff60458bda4..6521497eaed3 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -2115,7 +2115,7 @@ function createDraftInitialWorkspace(policyOwnerEmail = '', policyName = '', pol } function buildOptimisticPolicyCategories(policyID: string, categories: readonly string[]) { - const optimisticCategoryMap = categories.reduce((acc, category) => { + const optimisticCategoryMap = categories.reduce>>((acc, category) => { acc[category] = { name: category, enabled: true, @@ -2125,7 +2125,7 @@ function buildOptimisticPolicyCategories(policyID: string, categories: readonly return acc; }, {}); - const successCategoryMap = categories.reduce((acc, category) => { + const successCategoryMap = categories.reduce>>((acc, category) => { acc[category] = { errors: null, pendingAction: null, @@ -2133,7 +2133,7 @@ function buildOptimisticPolicyCategories(policyID: string, categories: readonly return acc; }, {}); - const failureCategoryMap = categories.reduce((acc, category) => { + const failureCategoryMap = categories.reduce>>((acc, category) => { acc[category] = { errors: ErrorUtils.getMicroSecondOnyxError('workspace.categories.createFailureMessage'), pendingAction: null, @@ -2510,7 +2510,7 @@ function createDraftWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policy { onyxMethod: Onyx.METHOD.SET, key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES_DRAFT}${policyID}`, - value: CONST.POLICY.DEFAULT_CATEGORIES.reduce((acc, category) => { + value: CONST.POLICY.DEFAULT_CATEGORIES.reduce>((acc, category) => { acc[category] = { name: category, enabled: true, From 06e0881e511cea6f76677d86851b79568f0a440a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Wed, 29 May 2024 12:07:44 +0200 Subject: [PATCH 24/27] add missing import Policy --- src/libs/actions/Policy/Policy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 8e3d1b73e608..0e28fca2fc3e 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -72,6 +72,7 @@ import type { InvitedEmailsToAccountIDs, PersonalDetailsList, Policy, + PolicyCategory, PolicyEmployee, PolicyOwnershipChangeChecks, PolicyTag, From 1d478a9f064538e766baa39a651df2f4399697a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Wed, 29 May 2024 12:22:40 +0200 Subject: [PATCH 25/27] fix types Category --- src/libs/actions/Policy/Category.ts | 59 +++++++++++++---------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/src/libs/actions/Policy/Category.ts b/src/libs/actions/Policy/Category.ts index 82bca6dc7c22..d9c93f22cfe0 100644 --- a/src/libs/actions/Policy/Category.ts +++ b/src/libs/actions/Policy/Category.ts @@ -1,5 +1,5 @@ import lodashUnion from 'lodash/union'; -import type {NullishDeep, OnyxCollection, OnyxUpdate} from 'react-native-onyx'; +import type {NullishDeep, OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import * as API from '@libs/API'; import type {EnablePolicyCategoriesParams, OpenPolicyCategoriesPageParams, SetPolicyDistanceRatesDefaultCategoryParams} from '@libs/API/parameters'; @@ -63,41 +63,34 @@ Onyx.connect({ callback: (val) => (allPolicyCategories = val), }); +type PolicyCategoriesOnyxValueMap = NonNullable>>; + function buildOptimisticPolicyCategories(policyID: string, categories: readonly string[]) { - const optimisticCategoryMap = categories.reduce( - (acc, category) => ({ - ...acc, - [category]: { - name: category, - enabled: true, - errors: null, - pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, - }, - }), - {}, - ); + const optimisticCategoryMap = categories.reduce((acc, category) => { + acc[category] = { + name: category, + enabled: true, + errors: null, + pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + }; + return acc; + }, {}); - const successCategoryMap = categories.reduce( - (acc, category) => ({ - ...acc, - [category]: { - errors: null, - pendingAction: null, - }, - }), - {}, - ); + const successCategoryMap = categories.reduce((acc, category) => { + acc[category] = { + errors: null, + pendingAction: null, + }; + return acc; + }, {}); - const failureCategoryMap = categories.reduce( - (acc, category) => ({ - ...acc, - [category]: { - errors: ErrorUtils.getMicroSecondOnyxError('workspace.categories.createFailureMessage'), - pendingAction: null, - }, - }), - {}, - ); + const failureCategoryMap = categories.reduce((acc, category) => { + acc[category] = { + errors: ErrorUtils.getMicroSecondOnyxError('workspace.categories.createFailureMessage'), + pendingAction: null, + }; + return acc; + }, {}); const onyxData: OnyxData = { optimisticData: [ From 2e3240e4ed8ba508eec0dd9fc7e330c24b310267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Wed, 29 May 2024 12:32:16 +0200 Subject: [PATCH 26/27] fix fix types Category --- src/libs/actions/Policy/Category.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libs/actions/Policy/Category.ts b/src/libs/actions/Policy/Category.ts index d9c93f22cfe0..294712666bdf 100644 --- a/src/libs/actions/Policy/Category.ts +++ b/src/libs/actions/Policy/Category.ts @@ -1,5 +1,5 @@ import lodashUnion from 'lodash/union'; -import type {NullishDeep, OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import type {NullishDeep, OnyxCollection, OnyxUpdate} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import * as API from '@libs/API'; import type {EnablePolicyCategoriesParams, OpenPolicyCategoriesPageParams, SetPolicyDistanceRatesDefaultCategoryParams} from '@libs/API/parameters'; @@ -63,10 +63,8 @@ Onyx.connect({ callback: (val) => (allPolicyCategories = val), }); -type PolicyCategoriesOnyxValueMap = NonNullable>>; - function buildOptimisticPolicyCategories(policyID: string, categories: readonly string[]) { - const optimisticCategoryMap = categories.reduce((acc, category) => { + const optimisticCategoryMap = categories.reduce>>((acc, category) => { acc[category] = { name: category, enabled: true, @@ -76,7 +74,7 @@ function buildOptimisticPolicyCategories(policyID: string, categories: readonly return acc; }, {}); - const successCategoryMap = categories.reduce((acc, category) => { + const successCategoryMap = categories.reduce>>((acc, category) => { acc[category] = { errors: null, pendingAction: null, @@ -84,7 +82,7 @@ function buildOptimisticPolicyCategories(policyID: string, categories: readonly return acc; }, {}); - const failureCategoryMap = categories.reduce((acc, category) => { + const failureCategoryMap = categories.reduce>>((acc, category) => { acc[category] = { errors: ErrorUtils.getMicroSecondOnyxError('workspace.categories.createFailureMessage'), pendingAction: null, From 20b6fecb9a1bfa160cac2d43893db58cf2c50e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Fri, 31 May 2024 17:11:01 +0200 Subject: [PATCH 27/27] force CI