diff --git a/src/utils/object.ts b/src/utils/object.ts index 15ab92d08..93d421fb0 100644 --- a/src/utils/object.ts +++ b/src/utils/object.ts @@ -12,11 +12,12 @@ export function omitBy(obj: T, predicate: (value: any) => bool * @returns A new object with just the picked properties */ export function pick(obj: T, keys: K[]): Pick { - // eslint-disable-next-line unicorn/no-array-reduce - return keys.reduce((result, key) => { + // Assertion: Required to avoid verbose runtime guards + const picked = {} as Pick + for (const key of keys) { if (key in obj) { - result[key] = obj[key] + picked[key] = obj[key] } - return result - }, {} as Pick) + } + return picked }