patch
@rotorsoft/act-root / act/src / patch
Function: patch()
patch<
S
>(original
,patches
):Readonly
<S
>
Defined in: libs/act/src/utils.ts:57
Immutably copies state with patches recursively.
Keys with undefined
or null
values in patch are deleted.
Type Parameters
S
S
extends Schema
Parameters
original
Readonly
<S
>
The original state object
patches
Readonly
<Patch
<S
>>
The patches to merge
Returns
Readonly
<S
>
A new patched state
Example
const newState = patch(oldState, { count: 5 });