Better-Auth 1.4.9 breaks type checks #2598

Closed
opened 2026-03-13 10:05:55 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @JE4GLE on GitHub (Dec 23, 2025).

To Reproduce

  1. Write the following code in version 1.4.8
const { error } = await authClient.organization.setActive({
  	organizationId,
  	organizationSlug
});
  1. Run any typescript checker like svelte-kit sync && svelte-check --tsconfig ./tsconfig.jsoneverything fine
  2. Update to version 1.4.9
  3. Run type checking again → lots of errors

The cache has been cleared and .svelte-kit and node_modules directories have been deleted

Current vs. Expected behavior

Current

Lots of type errors

Expected

No type errors

What version of Better Auth are you using?

1.4.9 (works in 1.4.8)

System info

The command npx @better-auth/cli info --json produces no output and results in exit code 1.

Which area(s) are affected? (Select all that apply)

Types, Client

Auth config (if applicable)

export const authClient = createAuthClient({
	plugins: [
		adminClient(),
		passkeyClient(),
		twoFactorClient(),
		emailOTPClient(),
		magicLinkClient(),
		anonymousClient(),
		...(PUBLIC_API_KEYS === 'true' ? [apiKeyClient()] : []),
		...(PUBLIC_ORGANIZATIONS === 'true' ? [organizationClient()] : []),
		...(PUBLIC_MULTISESSION === 'true' ? [multiSessionClient()] : []),
		...(PUBLIC_STRIPE === 'true'
			? [
					stripeClient({
						subscription: PUBLIC_SUBSCRIPTIONS === 'true'
					})
				]
			: [])
	]
});

Additional context

Examples of the type errors

I get the errors for authClient.organization:

Error: Property 'setActive' does not exist on type '{ checkRolePermission: <R extends "admin" | "member" | "owner">(data: ({ permission: { readonly organization?: ("update" | "delete")[] | undefined; readonly member?: ("update" | "create" | "delete")[] | undefined; readonly invitation?: ("cancel" | "create")[] | undefined; readonly team?: ("update" | ... 1 more ... |...'. 
): Promise<boolean> {
        const { error } = await authClient.organization.setActive({
                organizationId,

authClient.twoFactor (which is stating that the whole twoFactor plugin doesn't exist):

Error: Property 'twoFactor' does not exist on type '{ useListPasskeys: () => AuthQueryAtom<Passkey[]>; } & { useActiveOrganization: () => AuthQueryAtom<Prettify<{ id: string; name: string; slug: string; createdAt: Date; logo?: string | null | undefined; metadata?: any; } & { ...; }>>; useListOrganizations: () => AuthQueryAtom<...>; useActiveMember: () => AuthQueryAto...'. (ts)
        function handleVerifyCode() {
                authClient.twoFactor
                        .verifyTotp({

authClient.magicLink:

Error: Property 'magicLink' does not exist on type '{ social: <FetchOptions extends ClientFetchOption<Partial<{ provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | ... 21 more ... | "vercel"; ... 8 more ...; additionalData?: Record<...> | undefined; }> & Record<...'. (ts)
                        authClient.signIn
                                .magicLink({
                                        email: $formData.username,

authClient.admin:

Error: Property 'listUsers' does not exist on type '{ checkRolePermission: <R extends "user" | "admin">(data: ({ permission: { readonly user?: ("update" | "set-role" | "create" | "get" | "delete" | "list" | "ban" | "impersonate" | "set-password")[] | undefined; readonly session?: ("delete" | ... 1 more ... | "revoke")[] | undefined; }; permissions?: undefined; } | { ...'. (ts)
                authClient.admin
                        .listUsers({
                                query: {

and authClient.multiSession:

Error: Property 'multiSession' does not exist on type '{ useListPasskeys: () => AuthQueryAtom<Passkey[]>; } & { useActiveOrganization: () => AuthQueryAtom<Prettify<{ id: string; name: string; slug: string; createdAt: Date; logo?: string | null | undefined; metadata?: any; } & { ...; }>>; useListOrganizations: () => AuthQueryAtom<...>; useActiveMember: () => AuthQueryAto...'. (ts)
                }
                await authClient.multiSession.setActive({
                        sessionToken: session.token
Originally created by @JE4GLE on GitHub (Dec 23, 2025). ### To Reproduce 1. Write the following code in version 1.4.8 ```typescript const { error } = await authClient.organization.setActive({ organizationId, organizationSlug }); ``` 2. Run any typescript checker like `svelte-kit sync && svelte-check --tsconfig ./tsconfig.json` → **everything fine** 3. Update to version 1.4.9 4. Run type checking again → **lots of errors** The cache has been cleared and `.svelte-kit` and `node_modules` directories have been deleted ### Current vs. Expected behavior #### Current Lots of type errors #### Expected No type errors ### What version of Better Auth are you using? 1.4.9 (works in 1.4.8) ### System info ```bash The command npx @better-auth/cli info --json produces no output and results in exit code 1. ``` ### Which area(s) are affected? (Select all that apply) Types, Client ### Auth config (if applicable) ```typescript export const authClient = createAuthClient({ plugins: [ adminClient(), passkeyClient(), twoFactorClient(), emailOTPClient(), magicLinkClient(), anonymousClient(), ...(PUBLIC_API_KEYS === 'true' ? [apiKeyClient()] : []), ...(PUBLIC_ORGANIZATIONS === 'true' ? [organizationClient()] : []), ...(PUBLIC_MULTISESSION === 'true' ? [multiSessionClient()] : []), ...(PUBLIC_STRIPE === 'true' ? [ stripeClient({ subscription: PUBLIC_SUBSCRIPTIONS === 'true' }) ] : []) ] }); ``` ### Additional context #### **Examples** of the type errors I get the errors for `authClient.organization`: ```bash Error: Property 'setActive' does not exist on type '{ checkRolePermission: <R extends "admin" | "member" | "owner">(data: ({ permission: { readonly organization?: ("update" | "delete")[] | undefined; readonly member?: ("update" | "create" | "delete")[] | undefined; readonly invitation?: ("cancel" | "create")[] | undefined; readonly team?: ("update" | ... 1 more ... |...'. ): Promise<boolean> { const { error } = await authClient.organization.setActive({ organizationId, ``` `authClient.twoFactor` (which is stating that the whole twoFactor plugin doesn't exist): ```bash Error: Property 'twoFactor' does not exist on type '{ useListPasskeys: () => AuthQueryAtom<Passkey[]>; } & { useActiveOrganization: () => AuthQueryAtom<Prettify<{ id: string; name: string; slug: string; createdAt: Date; logo?: string | null | undefined; metadata?: any; } & { ...; }>>; useListOrganizations: () => AuthQueryAtom<...>; useActiveMember: () => AuthQueryAto...'. (ts) function handleVerifyCode() { authClient.twoFactor .verifyTotp({ ``` `authClient.magicLink`: ```bash Error: Property 'magicLink' does not exist on type '{ social: <FetchOptions extends ClientFetchOption<Partial<{ provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | ... 21 more ... | "vercel"; ... 8 more ...; additionalData?: Record<...> | undefined; }> & Record<...'. (ts) authClient.signIn .magicLink({ email: $formData.username, ``` `authClient.admin`: ```bash Error: Property 'listUsers' does not exist on type '{ checkRolePermission: <R extends "user" | "admin">(data: ({ permission: { readonly user?: ("update" | "set-role" | "create" | "get" | "delete" | "list" | "ban" | "impersonate" | "set-password")[] | undefined; readonly session?: ("delete" | ... 1 more ... | "revoke")[] | undefined; }; permissions?: undefined; } | { ...'. (ts) authClient.admin .listUsers({ query: { ``` and `authClient.multiSession`: ```bash Error: Property 'multiSession' does not exist on type '{ useListPasskeys: () => AuthQueryAtom<Passkey[]>; } & { useActiveOrganization: () => AuthQueryAtom<Prettify<{ id: string; name: string; slug: string; createdAt: Date; logo?: string | null | undefined; metadata?: any; } & { ...; }>>; useListOrganizations: () => AuthQueryAtom<...>; useActiveMember: () => AuthQueryAto...'. (ts) } await authClient.multiSession.setActive({ sessionToken: session.token ```
Author
Owner

@better-auth-agent[bot] commented on GitHub (Dec 23, 2025):

It seems that you are experiencing type-checking issues after updating to Better Auth version 1.4.9. Based on reports from the community, problems like these sometimes arise after updating to a new version due to changes or incompatibilities in types.

Here are some steps you can take to troubleshoot and potentially resolve the type errors you're encountering:

  1. Check for Changes in Type Definitions: Look at the release notes or changelog for Better Auth 1.4.9 to see if there have been alterations in type definitions that could affect your current implementation.

  2. Revert to Previous Version: If you urgently need your project to function without errors, consider reverting back to version 1.4.8 where everything was working properly.

  3. Clear TypeScript Cache: Sometimes, TypeScript caches type definitions. Try clearing the cache and running the type checker again.

  4. Reach Out for Support: Since this seems to be a significant issue, consider tagging @bekacru and @ping__ to seek further support from the Better Auth team.

Your feedback about the types after upgrading is valuable, and it may help improve the framework in future releases. Do you want more insights on specific type definitions you might be working with, or should I help you with other questions?

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

@better-auth-agent[bot] commented on GitHub (Dec 23, 2025): It seems that you are experiencing type-checking issues after updating to Better Auth version 1.4.9. Based on reports from the community, problems like these sometimes arise after updating to a new version due to changes or incompatibilities in types. Here are some steps you can take to troubleshoot and potentially resolve the type errors you're encountering: 1. **Check for Changes in Type Definitions**: Look at the release notes or changelog for Better Auth 1.4.9 to see if there have been alterations in type definitions that could affect your current implementation. 2. **Revert to Previous Version**: If you urgently need your project to function without errors, consider reverting back to version 1.4.8 where everything was working properly. 3. **Clear TypeScript Cache**: Sometimes, TypeScript caches type definitions. Try clearing the cache and running the type checker again. 4. **Reach Out for Support**: Since this seems to be a significant issue, consider tagging @bekacru and @ping__ to seek further support from the Better Auth team. Your feedback about the types after upgrading is valuable, and it may help improve the framework in future releases. Do you want more insights on specific type definitions you might be working with, or should I help you with other questions? _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) • [Discord](https://discord.gg/fG2XXEuQX3) • [GitHub](https://github.com/Skyvern-AI/Skyvern) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/fG2XXEuQX3) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/Skyvern-AI/Skyvern)
Author
Owner

@dosubot[bot] commented on GitHub (Dec 23, 2025):

This is a known issue in Better-Auth 1.4.9 and is related to recent changes in how the client and plugins are typed. The upgrade introduced a new AuthClient type that requires you to explicitly specify plugin types as generics, for example: AuthClient<{ plugins: [ApiKeyClientPlugin, OrganizationClientPlugin, ...] }> instead of relying on ReturnType<typeof createAuthClient>. Plugins now export their own types (like ApiKeyClientPlugin, TwoFactorClientPlugin, etc.), and these must be used in the generic for proper type inference. If you don't update your client typing, plugin properties like organization.setActive, twoFactor, magicLink, admin.listUsers, and multiSession.setActive may disappear from the inferred type, causing the errors you described [source].

Workarounds include:

  • Explicitly type your client using the new AuthClient helper and plugin types.
  • If you can't migrate immediately, you can use a type assertion (e.g., as ReturnType<typeof createAuthClient>) or temporarily disable strict TypeScript options like declaration, declarationMap, or exactOptionalPropertyTypes in your tsconfig.json. These workarounds may reduce type safety or plugin-specific typings [source].
  • For some edge cases, using a helper like UndefinedOnPartialDeep from type-fest can help bypass type errors [source].

This change is intentional and part of a broader refactor to centralize and improve plugin typing, but it is a breaking change that requires code updates [source]. There are still some unresolved edge cases, especially with strict TypeScript settings, but maintainers are aware and working on further fixes.

If you want to avoid these errors, update your client typing to use the new AuthClient type and plugin generics, and ensure all plugins are included in the generic parameter. If you need a quick fix, relax your TypeScript config as described above, but be aware of the trade-offs.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 23, 2025): <!-- Answer --> This is a known issue in Better-Auth 1.4.9 and is related to recent changes in how the client and plugins are typed. The upgrade introduced a new `AuthClient` type that requires you to explicitly specify plugin types as generics, for example: `AuthClient<{ plugins: [ApiKeyClientPlugin, OrganizationClientPlugin, ...] }>` instead of relying on `ReturnType<typeof createAuthClient>`. Plugins now export their own types (like `ApiKeyClientPlugin`, `TwoFactorClientPlugin`, etc.), and these must be used in the generic for proper type inference. If you don't update your client typing, plugin properties like `organization.setActive`, `twoFactor`, `magicLink`, `admin.listUsers`, and `multiSession.setActive` may disappear from the inferred type, causing the errors you described [[source](https://github.com/better-auth/better-auth/pull/5815)]. Workarounds include: - Explicitly type your client using the new `AuthClient` helper and plugin types. - If you can't migrate immediately, you can use a type assertion (e.g., `as ReturnType<typeof createAuthClient>`) or temporarily disable strict TypeScript options like `declaration`, `declarationMap`, or `exactOptionalPropertyTypes` in your `tsconfig.json`. These workarounds may reduce type safety or plugin-specific typings [[source](https://github.com/better-auth/better-auth/issues/2471)]. - For some edge cases, using a helper like `UndefinedOnPartialDeep` from `type-fest` can help bypass type errors [[source](https://github.com/better-auth/better-auth/issues/5674)]. This change is intentional and part of a broader refactor to centralize and improve plugin typing, but it is a breaking change that requires code updates [[source](https://github.com/better-auth/better-auth/pull/5184)]. There are still some unresolved edge cases, especially with strict TypeScript settings, but maintainers are aware and working on further fixes. If you want to avoid these errors, update your client typing to use the new `AuthClient` type and plugin generics, and ensure all plugins are included in the generic parameter. If you need a quick fix, relax your TypeScript config as described above, but be aware of the trade-offs. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/e5fd44f1-63b0-4eb7-90e9-c517e80f0b58?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/e5fd44f1-63b0-4eb7-90e9-c517e80f0b58?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/e5fd44f1-63b0-4eb7-90e9-c517e80f0b58?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/e5fd44f1-63b0-4eb7-90e9-c517e80f0b58?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e5fd44f1-63b0-4eb7-90e9-c517e80f0b58?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/e5fd44f1-63b0-4eb7-90e9-c517e80f0b58?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e5fd44f1-63b0-4eb7-90e9-c517e80f0b58?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20issue%20in%20Better-Auth%201.4.9%20and%20is%20related%20to%20recent%20changes%20in%20how%20the%20client%20and%20plugins%20are%20typed.%20The%20upgrade%20introduced%20a%20new%20%60AuthClient%60%20type%20that%20requires%20you%20to%20explicitly%20specify%20plugin%20types%20as%20generics%2C%20for%20example%3A%20%60AuthClient%3C%7B%20plugins%3A%20%5BApiKeyClientPlugin%2C%20OrganizationClientPlugin%2C%20...%5D%20%7D%3E%60%20instead%20of%20relying%20on%20%60ReturnType%3Ctypeof%20createAuthClient%3E%60.%20Plugins%20now%20export%20their%20own%20types%20%28like%20%60ApiKeyClientPlugin%60%2C%20%60TwoFactorClientPlugin%60%2C%20etc.%29%2C%20and%20these%20must%20be%20used%20in%20the%20generic%20for%20proper%20type%20inference.%20If%20you%20don%27t%20update%20your%20client%20typing%2C%20plugin%20properties%20like%20%60organization.setActive%60%2C%20%60twoFactor%60%2C%20%60magicLink%60%2C%20%60admin.listUsers%60%2C%20and%20%60multiSession.setActive%60%20may%20disappear%20from%20the%20inferred%20type%2C%20causing%20the%20errors%20you%20described%20%5B%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/pull/5815%29%5D.%0A%0AWorkarounds%20include%3A%0A-%20Explicitly%20type%20your%20client%20using%20the%20new%20%60AuthClient%60%20helper%20and%20plugin%20types.%0A-%20If%20you%20can%27t%20migrate%20immediately%2C%20you%20can%20use%20a%20type%20assertion%20%28e.g.%2C%20%60as%20ReturnType%3Ctypeof%20createAuthClient%3E%60%29%20or%20temporarily%20disable%20strict%20TypeScript%20options%20like%20%60declaration%60%2C%20%60declarationMap%60%2C%20or%20%60exactOptionalPropertyTypes%60%20in%20your%20%60tsconfig.json%60.%20These%20workarounds%20may%20reduce%20type%20safety%20or%20plugin-specific%20typings%20%5B%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/issues/2471%29%5D.%0A-%20For%20some%20edge%20cases%2C%20using%20a%20helper%20like%20%60UndefinedOnPartialDeep%60%20from%20%60type-fest%60%20can%20help%20bypass%20type%20errors%20%5B%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/issues/5674%29%5D.%0A%0AThis%20change%20is%20intentional%20and%20part%20of%20a%20broader%20refactor%20to%20centralize%20and%20improve%20plugin%20typing%2C%20but%20it%20is%20a%20breaking%20change%20that%20requires%20code%20updates%20%5B%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/pull/5184%29%5D.%20There%20are%20still%20some%20unresolved%20edge%20cases%2C%20especially%20with%20strict%20TypeScript%20settings%2C%20but%20maintainers%20are%20aware%20and%20working%20on%20further%20fixes.%0A%0AIf%20you%20want%20to%20avoid%20these%20errors%2C%20update%20your%20client%20typing%20to%20use%20the%20new%20%60AuthClient%60%20type%20and%20plugin%20generics%2C%20and%20ensure%20all%20plugins%20are%20included%20in%20the%20generic%20parameter.%20If%20you%20need%20a%20quick%20fix%2C%20relax%20your%20TypeScript%20config%20as%20described%20above%2C%20but%20be%20aware%20of%20the%20trade-offs.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/6965)
Author
Owner

@bytaesu commented on GitHub (Dec 23, 2025):

Hi @JE4GLE,

Is there a reason you're assigning plugin clients dynamically? For example, if you're using Organization plugin and then set the environment variable to false, the app build would fail.

@bytaesu commented on GitHub (Dec 23, 2025): Hi @JE4GLE, Is there a reason you're assigning plugin clients dynamically? For example, if you're using Organization plugin and then set the environment variable to false, the app build would fail.
Author
Owner

@bytaesu commented on GitHub (Dec 23, 2025):

Also, this type issue isn't caused by v1.4.9 I guess.. it occurs even on v1.4.6
However, basically I don't think this is a problem with the Better Auth package 🤔

@bytaesu commented on GitHub (Dec 23, 2025): Also, this type issue isn't caused by v1.4.9 I guess.. it occurs even on v1.4.6 However, basically I don't think this is a problem with the Better Auth package 🤔
Author
Owner

@JE4GLE commented on GitHub (Dec 23, 2025):

@bytaesu Thank you for your answer. I'm currently building a project where I'm testing different features and want to disable some.

Well, I installed 1.4.8, ran svelte-check without any problems. I installed 1.4.9 without changing anything else and the validation failed.

@JE4GLE commented on GitHub (Dec 23, 2025): @bytaesu Thank you for your answer. I'm currently building a project where I'm testing different features and want to disable some. Well, I installed 1.4.8, ran svelte-check without any problems. I installed 1.4.9 without changing anything else and the validation failed.
Author
Owner

@bytaesu commented on GitHub (Dec 23, 2025):

Hi @JE4GLE,

I think it would be better to include all necessary plugins in the instance and handle branching at runtime.

@bytaesu commented on GitHub (Dec 23, 2025): Hi @JE4GLE, I think it would be better to include all necessary plugins in the instance and handle branching at runtime.
Author
Owner

@JE4GLE commented on GitHub (Dec 23, 2025):

@bytaesu Thank you, I will change that
@dosu Some worked, but I were not able to find for example the type for the Admin plugin

@JE4GLE commented on GitHub (Dec 23, 2025): @bytaesu Thank you, I will change that @dosu Some worked, but I were not able to find for example the type for the Admin plugin
Author
Owner

@dosubot[bot] commented on GitHub (Dec 23, 2025):

You can type the Admin plugin for AuthClient generics using ReturnType. Import adminClient from better-auth/plugins/admin. For example:

import { adminClient } from "better-auth/plugins/admin";
import { AuthClient } from "better-auth";

type MyAuthClient = AuthClient<{
  plugins: [ReturnType<typeof adminClient> /*, ...other plugins */];
}>;

This ensures TypeScript recognizes all admin plugin methods on your client instance. The adminClient function returns the correct plugin type for use in generics, and all related types are re-exported from the same module for convenience
[source]
[source].

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 23, 2025): <!-- Answer --> You can type the Admin plugin for AuthClient generics using ReturnType<typeof adminClient>. Import adminClient from better-auth/plugins/admin. For example: ```typescript import { adminClient } from "better-auth/plugins/admin"; import { AuthClient } from "better-auth"; type MyAuthClient = AuthClient<{ plugins: [ReturnType<typeof adminClient> /*, ...other plugins */]; }>; ``` This ensures TypeScript recognizes all admin plugin methods on your client instance. The adminClient function returns the correct plugin type for use in generics, and all related types are re-exported from the same module for convenience [[source]](https://github.com/better-auth/better-auth/blob/922148f213efdfadc929a51fce0a84133fa626e4/packages/better-auth/src/plugins/admin/client.ts#L20-L98) [[source]](https://github.com/better-auth/better-auth/blob/922148f213efdfadc929a51fce0a84133fa626e4/packages/better-auth/src/plugins/admin/index.ts#L1-L3). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/ddabf776-bfac-4824-9ee5-19a0734eb53a?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ddabf776-bfac-4824-9ee5-19a0734eb53a?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ddabf776-bfac-4824-9ee5-19a0734eb53a?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ddabf776-bfac-4824-9ee5-19a0734eb53a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ddabf776-bfac-4824-9ee5-19a0734eb53a?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ddabf776-bfac-4824-9ee5-19a0734eb53a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ddabf776-bfac-4824-9ee5-19a0734eb53a?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=You%20can%20type%20the%20Admin%20plugin%20for%20AuthClient%20generics%20using%20ReturnType%3Ctypeof%20adminClient%3E.%20Import%20adminClient%20from%20better-auth/plugins/admin.%20For%20example%3A%0A%0A%60%60%60typescript%0Aimport%20%7B%20adminClient%20%7D%20from%20%22better-auth/plugins/admin%22%3B%0Aimport%20%7B%20AuthClient%20%7D%20from%20%22better-auth%22%3B%0A%0Atype%20MyAuthClient%20%3D%20AuthClient%3C%7B%0A%20%20plugins%3A%20%5BReturnType%3Ctypeof%20adminClient%3E%20/%2A%2C%20...other%20plugins%20%2A/%5D%3B%0A%7D%3E%3B%0A%60%60%60%0A%0AThis%20ensures%20TypeScript%20recognizes%20all%20admin%20plugin%20methods%20on%20your%20client%20instance.%20The%20adminClient%20function%20returns%20the%20correct%20plugin%20type%20for%20use%20in%20generics%2C%20and%20all%20related%20types%20are%20re-exported%20from%20the%20same%20module%20for%20convenience%0A%5B%5Bsource%5D%5D%28https%3A//github.com/better-auth/better-auth/blob/922148f213efdfadc929a51fce0a84133fa626e4/packages/better-auth/src/plugins/admin/client.ts%23L20-L98%29%0A%5B%5Bsource%5D%5D%28https%3A//github.com/better-auth/better-auth/blob/922148f213efdfadc929a51fce0a84133fa626e4/packages/better-auth/src/plugins/admin/index.ts%23L1-L3%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/6965)
Author
Owner

@bytaesu commented on GitHub (Dec 23, 2025):

Hello @JE4GLE,

Due to type issues caused by recent changes in the multi-session plugin, we reverted it a few hours ago. It seems this isn't reflected in the released v1.4.9 yet.

In the same setup as yours, the issue has been resolved in this beta version!
Please let me know if you have any questions 🙂

 "better-auth": "1.4.10-beta.1",

+) But... I still don't recommend dynamically adding or removing plugins, as it can cause issues in the app itself. Helper plugins like OpenAPI seems fine, but I think that plugins that affect runtime aren't suitable for this!

@bytaesu commented on GitHub (Dec 23, 2025): Hello @JE4GLE, Due to type issues caused by recent changes in the `multi-session` plugin, we reverted it a few hours ago. It seems this isn't reflected in the released v1.4.9 yet. In the same setup as yours, the issue has been resolved in this beta version! Please let me know if you have any questions 🙂 ``` "better-auth": "1.4.10-beta.1", ``` +) But... I still don't recommend dynamically adding or removing plugins, as it can cause issues in the app itself. Helper plugins like OpenAPI seems fine, but I think that plugins that affect runtime aren't suitable for this!
Author
Owner

@bytaesu commented on GitHub (Dec 23, 2025):

Since this issue has been resolved, I'm closing this. If you have any questions, feel free to mention me 🤗

@bytaesu commented on GitHub (Dec 23, 2025): Since this issue has been resolved, I'm closing this. If you have any questions, feel free to mention me 🤗
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2598