From 4ae74ff43e8071fdd39333d00f7866bbbe8434c1 Mon Sep 17 00:00:00 2001 From: Github Date: Tue, 24 Sep 2024 15:25:12 +0200 Subject: [PATCH] feat:add babel plugin-transform-object-rest-spread --- babel.config.js | 1 + src/libs/OptionsListUtils.ts | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/babel.config.js b/babel.config.js index 3721edaa7afb..663eb29d5d2f 100644 --- a/babel.config.js +++ b/babel.config.js @@ -21,6 +21,7 @@ const defaultPlugins = [ '@babel/transform-runtime', '@babel/plugin-proposal-class-properties', + ['@babel/plugin-transform-object-rest-spread', {useBuiltIns: true, loose: true}], // We use `@babel/plugin-transform-class-properties` for transforming ReactNative libraries and do not use it for our own // source code transformation as we do not use class property assignment. diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index afedd308371c..50242435ed36 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -496,9 +496,11 @@ function getAllReportErrors(report: OnyxEntry, reportActions: OnyxEntry< reportActionErrors.smartscan = ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericSmartscanFailureMessage'); } // All error objects related to the report. Each object in the sources contains error messages keyed by microtime - // Use Object.assign to merge all error objects into one since it is faster and uses less memory than spread operator - // eslint-disable-next-line prefer-object-spread - const errorSources = Object.assign({}, reportErrors, reportErrorFields, reportActionErrors); + const errorSources = { + reportErrors, + ...reportErrorFields, + ...reportActionErrors, + }; // Combine all error messages keyed by microtime into one object const errorSourcesArray = Object.values(errorSources ?? {});