-
-
Notifications
You must be signed in to change notification settings - Fork 207
Open
Description
Package version
21.6.1
Describe the bug
If you call .merge()
with object that has property with undefined value, it will actually update the attribute. It should instead skip the property.
Example
type UpdateUserProps = {
email?: string
password?: string
currentPassword?: string
}
export class UserService {
async update(user: User, payload: UpdateUserProps) {
user.merge({
email: payload.email,
password: payload.password,
})
return await user.save()
}
}
Calling userService.update(user, { password: 'test' })
would set email to undefined
.
Reproduction repo
No response
mazinsw, lncitador and saullo
Metadata
Metadata
Assignees
Labels
No labels