Skip to content

Conversation

@narasaka
Copy link
Contributor

@narasaka narasaka commented Nov 28, 2025

Prior to this commit, any plugins added to the betterauth setup would not have inference and would just break builds. This commit removes the generic type and fixes betterauth's plugins/extensions inferences.

Before the fix:
The admin() plugin has a few additional methods you can use such as api.auth.userHasPermission(), but it is not seen / inferred here.
image
image

After the fix:
All the methods that the plugin provides are now available / inferred properly.
image
image

Note:

  • This is using the latest versions of better-auth (v1.4.3) and better-t-stack (v3.6.5)

Summary by CodeRabbit

  • Refactor
    • Simplified authentication initialization templates across all supported database systems (Prisma, Drizzle, MongoDB, Workers) and runtime environments. Generated authentication setup code now features cleaner, more straightforward signatures that are easier to understand and maintain while preserving all existing functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

…lates

Prior to this commit, any plugins added to the betterauth setup would
not have inference and would just break builds. This commit removes the
generic type and fixes betterauth's plugins/extensions inferences.
@vercel
Copy link

vercel bot commented Nov 28, 2025

@narasaka is attempting to deploy a commit to the Better T Stack Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Walkthrough

The handlebars template for better-auth server configuration was updated to remove explicit generic type parameters from betterAuth factory function calls. BetterAuthOptions type imports were also removed, simplifying the TypeScript signature across all ORM/runtime branches.

Changes

Cohort / File(s) Summary
Better-Auth Template Generics Removal
apps/cli/templates/auth/better-auth/server/base/src/index.ts.hbs
Removed generic type parameter <BetterAuthOptions> from betterAuth factory calls; removed BetterAuthOptions from imports across Prisma, Drizzle, Workers, Mongoose, and None conditional branches

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Verify the change is consistently applied across all five ORM/runtime branches
  • Confirm that removing the generic type parameter does not break type inference in the build

Poem

🐰 Hops of joy! <Generic> tags fade away,
Simpler auth shines bright today,
Types inferred, no need to say,
Five branches blessed—hip hip hooray! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing the BetterAuthOptions generic type from better-auth templates across all ORM/runtime branches, which directly matches the file modifications summarized.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@narasaka narasaka marked this pull request as ready for review November 28, 2025 19:45
@AmanVarshney01
Copy link
Owner

Looks good! Thanks @narasaka

@AmanVarshney01 AmanVarshney01 merged commit 730edd2 into AmanVarshney01:main Dec 3, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants