[PR #3610] [CLOSED] fix(admin-plugin) list user endpoint incorrect return type #4912

Closed
opened 2026-03-13 12:04:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3610
Author: @shahriar-shojib
Created: 7/25/2025
Status: Closed

Base: mainHead: fix/list-user-response-type


📝 Commits (1)

  • 42f8376 fix(admin-plugin) list user endpoint incorrect return type

📊 Changes

1 file changed (+7 additions, -7 deletions)

View changed files

📝 packages/better-auth/src/plugins/admin/admin.ts (+7 -7)

📄 Description

Previously, the return type of auth.admin.listUsers was awkward, which required casting types forcefully

{
    users: UserWithRole[];
    total: number;
    limit: number | undefined;
    offset: number | undefined;
} | {
    users: never[];
    total: number;
}

Now it's

{
    users: UserWithRole[];
    total: number;
}

Summary by cubic

Fixed the return type of the admin list users endpoint to always return a consistent object shape with a typed users array and total count. This removes the need for type casting when handling empty user lists.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/3610 **Author:** [@shahriar-shojib](https://github.com/shahriar-shojib) **Created:** 7/25/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/list-user-response-type` --- ### 📝 Commits (1) - [`42f8376`](https://github.com/better-auth/better-auth/commit/42f8376dc6a0769e154c0d9bcf2cdb8f6fe23c37) fix(admin-plugin) list user endpoint incorrect return type ### 📊 Changes **1 file changed** (+7 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/admin/admin.ts` (+7 -7) </details> ### 📄 Description Previously, the return type of `auth.admin.listUsers` was awkward, which required casting types forcefully ```ts { users: UserWithRole[]; total: number; limit: number | undefined; offset: number | undefined; } | { users: never[]; total: number; } ``` Now it's ```ts { users: UserWithRole[]; total: number; } ``` <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixed the return type of the admin list users endpoint to always return a consistent object shape with a typed users array and total count. This removes the need for type casting when handling empty user lists. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:04:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#4912