[PR #6490] [MERGED] fix: export organization plugin types #23601

Closed
opened 2026-04-15 21:51:33 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6490
Author: @pffigueiredo
Created: 12/3/2025
Status: Merged
Merged: 12/3/2025
Merged by: @himself65

Base: canaryHead: fix/type-inference-on-create-client


📝 Commits (1)

  • 6468ff9 fix: export organization plugin types

📊 Changes

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

View changed files

📝 packages/better-auth/src/client/index.ts (+1 -0)

📄 Description

Problem

TypeScript requires complex Zod inference types to be exported, so that we can get type inference in the createAuthClient when used with plugins. However, the organization zod inferred types weren't being properly exported, thus, TS couldn't automatically infer them.

E.g.

// this would throw a TS error we tried to generate the declaration types
export const supportedBetterAuthClientPlugins = [
  organizationClient(),
] satisfies BetterAuthClientOptions['plugins'];

ERROR

The inferred type of 'supportedBetterAuthClientPlugins' cannot be named without a reference to '../../../../node_modules/better-auth/dist/index-Bl9JYXWC.mjs'. This is likely not portable. A type annotation is necessary.

Fix

The fix seems to be, simply re-exporting the types, making them available to TS in the consumer application.

Test Plan

I couldn't build a proper test for this, since it would have to happen in a isolated env that didn't have access to the codebase types. However, I did build this locally and used the local version to make sure that there were no errors when exporting the organization's plugin types.


Summary by cubic

Exported organization plugin types from the client index to restore TypeScript inference for plugins in createAuthClient. Fixes the non-portable “inferred type cannot be named” error in consumer builds.

Written for commit 6468ff9a3c. 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/6490 **Author:** [@pffigueiredo](https://github.com/pffigueiredo) **Created:** 12/3/2025 **Status:** ✅ Merged **Merged:** 12/3/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/type-inference-on-create-client` --- ### 📝 Commits (1) - [`6468ff9`](https://github.com/better-auth/better-auth/commit/6468ff9a3c83f85ebda8a7e462cdf54167b333bf) fix: export organization plugin types ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/client/index.ts` (+1 -0) </details> ### 📄 Description ## Problem TypeScript requires complex Zod inference types to be exported, so that we can get type inference in the `createAuthClient` when used with plugins. However, the `organization` zod inferred types weren't being properly exported, thus, TS couldn't automatically infer them. E.g. ```.ts // this would throw a TS error we tried to generate the declaration types export const supportedBetterAuthClientPlugins = [ organizationClient(), ] satisfies BetterAuthClientOptions['plugins']; ``` **ERROR** ``` The inferred type of 'supportedBetterAuthClientPlugins' cannot be named without a reference to '../../../../node_modules/better-auth/dist/index-Bl9JYXWC.mjs'. This is likely not portable. A type annotation is necessary. ``` ## Fix The fix seems to be, simply re-exporting the types, making them available to TS in the consumer application. ## Test Plan I couldn't build a proper test for this, since it would have to happen in a isolated env that didn't have access to the codebase types. However, I did build this locally and used the local version to make sure that there were no errors when exporting the organization's plugin types. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Exported organization plugin types from the client index to restore TypeScript inference for plugins in createAuthClient. Fixes the non-portable “inferred type cannot be named” error in consumer builds. <sup>Written for commit 6468ff9a3c83f85ebda8a7e462cdf54167b333bf. 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-15 21:51:33 -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#23601