diff --git a/babel.config.js b/babel.config.js index 3721edaa7af..663eb29d5d2 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 afedd308371..50242435ed3 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 ?? {});