sanity-io/client

client.users.getById() type is too strict

Opened this issue · 0 comments

user.getById() types feels too strict to me.

Right not it looks like:

getById<T extends 'me' | string>(
  id: T
): T extends 'me' ? Observable<CurrentSanityUser> : Observable<SanityUser>

I am actually using this method by passing a string with several IDs separated with a comma, in this case the result looks like it should be typed with Observable<SanityUser[]> (it's an array).

Also, the current type of SanityUser includes a required isCurrentUser boolean property which is missing from my requests.