// 工具函数：过滤掉对象中值为空的属性
const filterEmptyProps = <T extends object>(obj: T): Partial<T> => {
  return Object.entries(obj).reduce((acc, [key, value]) => {
    // 定义空值判断：排除 null、undefined、空字符串
    const isEmpty = value === null || value === undefined || value === "";

    if (!isEmpty) {
      acc[key as keyof T] = value;
    }
    return acc;
  }, {} as Partial<T>);
};

export { filterEmptyProps };
