refactor: simplify typing

This commit is contained in:
Carlos Valente
2025-02-15 14:46:01 +01:00
committed by Carlos Valente
parent 11c1b472a2
commit d21e1f996f
+2 -2
View File
@@ -67,11 +67,11 @@ export function mergeObject<T extends object>(a: T, b: Partial<T>): T {
* @param {object} obj
*/
export const removeUndefined = <T extends Record<string, unknown>>(obj: T): Partial<T> => {
return Object.keys(obj).reduce((patched, key) => {
return Object.keys(obj).reduce<Partial<T>>((patched, key) => {
if (typeof obj[key] !== 'undefined') {
// @ts-expect-error -- not sure how to type this
patched[key] = obj[key];
}
return patched;
}, {} as Partial<T>);
}, {});
};