mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-06 16:03:52 +00:00
refactor: simplify typing
This commit is contained in:
committed by
Carlos Valente
parent
11c1b472a2
commit
d21e1f996f
@@ -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>);
|
||||
}, {});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user