mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 21:28:09 +08:00
eaeb75eb44
* type: type refactor * chore: fix type WrapProps * chore: remove generic of Component --------- Co-authored-by: 张宁宁 <zhangnn1@yonghui.cn>
22 lines
460 B
TypeScript
22 lines
460 B
TypeScript
import type { AnyObject } from './type';
|
|
|
|
const extendsObject = <T extends AnyObject = AnyObject>(...list: T[]) => {
|
|
const result: AnyObject = { ...list[0] };
|
|
|
|
for (let i = 1; i < list.length; i++) {
|
|
const obj = list[i];
|
|
if (obj) {
|
|
Object.keys(obj).forEach((key) => {
|
|
const val = obj[key];
|
|
if (val !== undefined) {
|
|
result[key] = val;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
return result;
|
|
};
|
|
|
|
export default extendsObject;
|