mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 19:19:26 +08:00
951e0e2c79
* fix(list): fix pagination parameter error
* test: add case
* test: update snapshot
* chore: update case
* feat(util): add mergeProps
ref: 3c87f1c5b1/src/utils/with-default-props.tsx (L5)
* chore: replace method
* chore: rename
22 lines
444 B
TypeScript
22 lines
444 B
TypeScript
type RecordType = Record<string, any>;
|
|
|
|
function extendsObject<T extends RecordType>(...list: T[]) {
|
|
const result: RecordType = { ...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;
|