From c7d82b09f56a391cbc71b29388bb8d2e9de25272 Mon Sep 17 00:00:00 2001 From: wholteza Date: Tue, 9 Jan 2024 17:40:39 +0100 Subject: [PATCH] Fix for empty number inputs breaking --- src/helpers/dynamic-object-helpers.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/helpers/dynamic-object-helpers.ts b/src/helpers/dynamic-object-helpers.ts index 9d7ae03..7d7b083 100644 --- a/src/helpers/dynamic-object-helpers.ts +++ b/src/helpers/dynamic-object-helpers.ts @@ -13,8 +13,10 @@ export const mutatePropOnPath = ( return; } - const propType = typeof dynamicObject[key]; - if (propType !== typeof newValue) { + // TODO: Add a test for this + const oldValue = dynamicObject[key]; + const propType = typeof oldValue; + if (propType !== typeof newValue && oldValue !== null) { throw new Error(`The provided value is not of type ${propType}`); }