[PR #7353] [MERGED] fix(stripe): add generic return type to getSchema for proper field inference #7253

Closed
opened 2026-03-13 13:29:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7353
Author: @bytaesu
Created: 1/14/2026
Status: Merged
Merged: 1/14/2026
Merged by: @himself65

Base: canaryHead: 2026-01-14/fix/stripe-schema-type


📝 Commits (1)

  • 34eb73c fix: add generic return type to getSchema for proper field inference

📊 Changes

2 files changed (+49 additions, -4 deletions)

View changed files

📝 packages/stripe/src/schema.ts (+10 -4)
📝 packages/stripe/test/stripe.test.ts (+39 -0)

📄 Description

Note

At the moment, stripeCustomerId isn't accessible on organization, but since it's not directly needed in typical use cases, this is acceptable for now, though there's room for improvement.


Summary by cubic

Fixed Stripe schema type inference by making getSchema generic, so plugin fields (like user.stripeCustomerId) are correctly inferred, even with additional user fields. Added type tests to validate inference. Closes #6440.

  • Bug Fixes
    • getSchema now returns a conditional type based on StripeOptions for subscription and organization schemas.
    • Correctly infers user.stripeCustomerId in $Infer types alongside user.additionalFields.
    • stripeCustomerId remains unavailable on organization for now.

Written for commit 34eb73c4f6. Summary will update 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/7353 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 1/14/2026 **Status:** ✅ Merged **Merged:** 1/14/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2026-01-14/fix/stripe-schema-type` --- ### 📝 Commits (1) - [`34eb73c`](https://github.com/better-auth/better-auth/commit/34eb73c4f67a69ea69344b85cee3db5a7970a165) fix: add generic return type to getSchema for proper field inference ### 📊 Changes **2 files changed** (+49 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/stripe/src/schema.ts` (+10 -4) 📝 `packages/stripe/test/stripe.test.ts` (+39 -0) </details> ### 📄 Description > [!NOTE] > At the moment, `stripeCustomerId` isn't accessible on organization, but since it's not directly needed in typical use cases, this is acceptable for now, though there's room for improvement. - Closes https://github.com/better-auth/better-auth/issues/6440 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixed Stripe schema type inference by making getSchema generic, so plugin fields (like user.stripeCustomerId) are correctly inferred, even with additional user fields. Added type tests to validate inference. Closes #6440. - **Bug Fixes** - getSchema now returns a conditional type based on StripeOptions for subscription and organization schemas. - Correctly infers user.stripeCustomerId in $Infer types alongside user.additionalFields. - stripeCustomerId remains unavailable on organization for now. <sup>Written for commit 34eb73c4f67a69ea69344b85cee3db5a7970a165. Summary will update 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-03-13 13:29:47 -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#7253