Skip to content

Commit

Permalink
fix: partial and playground (#1788)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni authored Feb 12, 2024
1 parent 0852ae4 commit e77eaf8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/utils/Partials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ export function mergePartialAndDefault<T extends Record<string, any>>(
const isArray = Array.isArray(prop);
if (isArray) {
// merge array into target with a new array instance so we dont touch the default value
target[propName] = Array(target[propName]);
for (const [index, value] of prop.entries()) {
target[propName][index] = value;
}
target[propName] = [...(target[propName] ?? []), ...(prop ?? [])];
} else if (isObjectOrClass && isRegularObject) {
target[propName] = mergePartialAndDefault(target[propName], prop);
} else if (prop) {
Expand Down

0 comments on commit e77eaf8

Please sign in to comment.