From ccf8ffb0b534fbda2ed4bc567b1e43c7285692b0 Mon Sep 17 00:00:00 2001 From: Forrest Wolf Date: Wed, 25 May 2022 11:32:26 -0400 Subject: [PATCH] Add explicit types to removeUndefinedProps --- common/util/object.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/util/object.ts b/common/util/object.ts index c970cb24..4048c7d9 100644 --- a/common/util/object.ts +++ b/common/util/object.ts @@ -1,9 +1,10 @@ import { union } from 'lodash' -export const removeUndefinedProps = (obj: T): T => { - const newObj: any = {} +export const removeUndefinedProps = (obj: T): Partial => { + const newObj: Partial = {} - for (const key of Object.keys(obj)) { + const keys = Object.keys(obj) as Array + for (const key of keys) { if ((obj as any)[key] !== undefined) newObj[key] = (obj as any)[key] }