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] }