mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 17:19:11 +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;
|