[GH-ISSUE #711] Typescript error - client's updateUser to have nullable fields and not optional #8390

Closed
opened 2026-04-13 03:27:50 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @arfath-linklet on GitHub (Dec 1, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/711

Describe the bug
User should be able to unset name and/or image.

updateUser({
  image: null,
  name: null,
});

This throws a typescript error as it expects string | undefined but works when force invoked with null

Originally created by @arfath-linklet on GitHub (Dec 1, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/711 **Describe the bug** User should be able to unset name and/or image. ``` updateUser({ image: null, name: null, }); ``` This throws a typescript error as it expects string | undefined but works when force invoked with null
GiteaMirror added the lockedbug labels 2026-04-13 03:27:50 -05:00
Author
Owner

@Bekacru commented on GitHub (Dec 2, 2024):

name cannot be null, as it is a required field. but we should allow it for image.

<!-- gh-comment-id:2510695693 --> @Bekacru commented on GitHub (Dec 2, 2024): name cannot be null, as it is a required field. but we should allow it for image.
Author
Owner

@Nicolab commented on GitHub (Dec 13, 2024):

Hello,

Very useful (thanks!), but there seems to be an issue. If we pass only the property image, the field is not updated to the DB. With Drizzle in my case.
If I add a second field, that works.

Example (work-around) :

updateUser({
  image: null,
  _nonce: Date.now(),
});
<!-- gh-comment-id:2540281324 --> @Nicolab commented on GitHub (Dec 13, 2024): Hello, Very useful (thanks!), but there seems to be an issue. If we pass only the property `image`, the field is not updated to the DB. With Drizzle in my case. If I add a second field, that works. Example (work-around) : ```ts updateUser({ image: null, _nonce: Date.now(), }); ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8390