@@ -1236,14 +1236,11 @@ function prepareKeyValuePairsForStorage(
12361236 return pairs ;
12371237}
12381238
1239- function mergeChanges < TValue extends OnyxInput < OnyxKey > | undefined , TChange extends OnyxInput < OnyxKey > | undefined > ( changes : TChange [ ] , existingValue ?: TValue ) : FastMergeResult < TChange > {
1239+ function mergeChanges < TValue extends OnyxInput < OnyxKey > | undefined > ( changes : TValue [ ] , existingValue ?: TValue ) : FastMergeResult < TValue > {
12401240 return applyMerge ( 'merge' , changes , existingValue ) ;
12411241}
12421242
1243- function mergeAndMarkChanges < TValue extends OnyxInput < OnyxKey > | undefined , TChange extends OnyxInput < OnyxKey > | undefined > (
1244- changes : TChange [ ] ,
1245- existingValue ?: TValue ,
1246- ) : FastMergeResult < TChange > {
1243+ function mergeAndMarkChanges < TValue extends OnyxInput < OnyxKey > | undefined > ( changes : TValue [ ] , existingValue ?: TValue ) : FastMergeResult < TValue > {
12471244 return applyMerge ( 'mark' , changes , existingValue ) ;
12481245}
12491246
@@ -1253,11 +1250,7 @@ function mergeAndMarkChanges<TValue extends OnyxInput<OnyxKey> | undefined, TCha
12531250 * @param changes Array of changes that should be merged
12541251 * @param existingValue The existing value that should be merged with the changes
12551252 */
1256- function applyMerge < TValue extends OnyxInput < OnyxKey > | undefined , TChange extends OnyxInput < OnyxKey > | undefined > (
1257- mode : 'merge' | 'mark' ,
1258- changes : TChange [ ] ,
1259- existingValue ?: TValue ,
1260- ) : FastMergeResult < TChange > {
1253+ function applyMerge < TValue extends OnyxInput < OnyxKey > | undefined > ( mode : 'merge' | 'mark' , changes : TValue [ ] , existingValue ?: TValue ) : FastMergeResult < TValue > {
12611254 const lastChange = changes ?. at ( - 1 ) ;
12621255
12631256 if ( Array . isArray ( lastChange ) ) {
@@ -1266,7 +1259,7 @@ function applyMerge<TValue extends OnyxInput<OnyxKey> | undefined, TChange exten
12661259
12671260 if ( changes . some ( ( change ) => change && typeof change === 'object' ) ) {
12681261 // Object values are then merged one after the other
1269- return changes . reduce < FastMergeResult < TChange > > (
1262+ return changes . reduce < FastMergeResult < TValue > > (
12701263 ( modifiedData , change ) => {
12711264 const options : FastMergeOptions = mode === 'merge' ? { shouldRemoveNestedNulls : true , objectRemovalMode : 'replace' } : { objectRemovalMode : 'mark' } ;
12721265 const { result, replaceNullPatches} = utils . fastMerge ( modifiedData . result , change , options ) ;
@@ -1279,15 +1272,15 @@ function applyMerge<TValue extends OnyxInput<OnyxKey> | undefined, TChange exten
12791272 return modifiedData ;
12801273 } ,
12811274 {
1282- result : ( existingValue ?? { } ) as TChange ,
1275+ result : ( existingValue ?? { } ) as TValue ,
12831276 replaceNullPatches : [ ] ,
12841277 } ,
12851278 ) ;
12861279 }
12871280
12881281 // If we have anything else we can't merge it so we'll
12891282 // simply return the last value that was queued
1290- return { result : lastChange as TChange , replaceNullPatches : [ ] } ;
1283+ return { result : lastChange as TValue , replaceNullPatches : [ ] } ;
12911284}
12921285
12931286/**
0 commit comments