diff --git a/src/utils.ts b/src/utils.ts index f7ba228..8d42f49 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -49,7 +49,11 @@ export function cloneRecursive(object: T) { objectCopy[key] = value.slice(); for (let j = 0; j < value.length; j++) { - objectCopy[key][j] = cloneRecursive(value[j]); + const item = value[j]; + objectCopy[key][j] = + item && typeof item === "object" + ? cloneRecursive(item) + : item; } } else { objectCopy[key] = cloneRecursive(value);