[PR #6997] [MERGED] fix(admin): custom role type inference #32616

Closed
opened 2026-04-17 23:23:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6997
Author: @bytaesu
Created: 12/25/2025
Status: Merged
Merged: 12/25/2025
Merged by: @Bekacru

Base: canaryHead: 2025-12-26/fix/admin-custom-roles


📝 Commits (3)

  • c6072a3 test: add test case for custom roles typecheck
  • a82f90a fix(admin): custom role type inference
  • e9d54fa fix: improve options spreading

📊 Changes

2 files changed (+24 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/plugins/admin/admin.test.ts (+19 -0)
📝 packages/better-auth/src/plugins/admin/admin.ts (+5 -2)

📄 Description


Summary by cubic

Fixes custom role type inference in the admin plugin so createUser accepts and returns user-defined roles like "support." Updates option merging to preserve generics while keeping required defaults.

  • Bug Fixes
    • Correctly types merged AdminOptions to retain custom role unions.
    • Adds a test verifying createUser accepts and persists the "support" role.

Written for commit e9d54fa271. Summary will update automatically on new commits.


🔄 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/6997 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 12/25/2025 **Status:** ✅ Merged **Merged:** 12/25/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `2025-12-26/fix/admin-custom-roles` --- ### 📝 Commits (3) - [`c6072a3`](https://github.com/better-auth/better-auth/commit/c6072a39b94af2c07d38d15da940b9c66cce533f) test: add test case for custom roles typecheck - [`a82f90a`](https://github.com/better-auth/better-auth/commit/a82f90a52711802799fad669e6697c6998fefd39) fix(admin): custom role type inference - [`e9d54fa`](https://github.com/better-auth/better-auth/commit/e9d54fa27136ec000ef1d781beec7c809572fd7f) fix: improve options spreading ### 📊 Changes **2 files changed** (+24 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/admin/admin.test.ts` (+19 -0) 📝 `packages/better-auth/src/plugins/admin/admin.ts` (+5 -2) </details> ### 📄 Description - Closes https://github.com/better-auth/better-auth/issues/6991 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes custom role type inference in the admin plugin so createUser accepts and returns user-defined roles like "support." Updates option merging to preserve generics while keeping required defaults. - **Bug Fixes** - Correctly types merged AdminOptions to retain custom role unions. - Adds a test verifying createUser accepts and persists the "support" role. <sup>Written for commit e9d54fa27136ec000ef1d781beec7c809572fd7f. Summary will update automatically on new commits.</sup> <!-- 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-04-17 23:23:02 -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#32616