From 8a106dde57ade18cc8dfdc648a8f9296c7bef878 Mon Sep 17 00:00:00 2001 From: dwelle Date: Sat, 12 Dec 2020 21:23:01 +0100 Subject: [PATCH] compare to undefined directly --- src/element/mutateElement.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/element/mutateElement.ts b/src/element/mutateElement.ts index edbeb7f4d..50ebe1c39 100644 --- a/src/element/mutateElement.ts +++ b/src/element/mutateElement.ts @@ -24,13 +24,13 @@ export const mutateElement = >( // (see https://github.com/microsoft/TypeScript/issues/21732) const { points } = updates as any; - if (typeof points !== "undefined") { + if (points !== undefined) { updates = { ...getSizeFromPoints(points), ...updates }; } for (const key in updates) { const value = (updates as any)[key]; - if (typeof value !== "undefined") { + if (value !== undefined) { if ( (element as any)[key] === value && // if object, always update in case its deep prop was mutated @@ -72,9 +72,9 @@ export const mutateElement = >( } if ( - typeof updates.height !== "undefined" || - typeof updates.width !== "undefined" || - typeof points !== "undefined" + updates.height !== undefined || + updates.width !== undefined || + points !== undefined ) { invalidateShapeForElement(element); }