docs: use type-only import for BetterAuthClientPlugin (#7565)

Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
Tim Keller
2026-01-23 11:34:53 -08:00
committed by Alex Yang
parent d6d627089d
commit 588c6b68f1
6 changed files with 10 additions and 5 deletions

View File

@@ -461,7 +461,7 @@ const myPlugin = () => {
If your endpoints need to be called from the client, you'll also need to create a client plugin. Better Auth clients can infer the endpoints from the server plugins. You can also add additional client-side logic.
```ts title="client-plugin.ts"
import type { BetterAuthClientPlugin } from "better-auth";
import type { BetterAuthClientPlugin } from "better-auth/client";
export const myPluginClient = () => {
return {

View File

@@ -164,7 +164,7 @@ First, lets create our `client.ts` file first:
</Files>
Then, add the following code:
```ts title="client.ts"
import { BetterAuthClientPlugin } from "better-auth";
import type { BetterAuthClientPlugin } from "better-auth/client";
import type { birthdayPlugin } from "./index"; // make sure to import the server plugin as a type // [!code highlight]
type BirthdayPlugin = typeof birthdayPlugin;

View File

@@ -1,4 +1,4 @@
import type { BetterAuthClientPlugin } from "better-auth";
import type { BetterAuthClientPlugin } from "better-auth/client";
import type { scim } from "./index";
export const scimClient = () => {

View File

@@ -1,4 +1,4 @@
import type { BetterAuthClientPlugin } from "better-auth";
import type { BetterAuthClientPlugin } from "better-auth/client";
import type { SSOPlugin } from "./index";
interface SSOClientOptions {

View File

@@ -1,4 +1,4 @@
import type { BetterAuthClientPlugin } from "better-auth";
import type { BetterAuthClientPlugin } from "better-auth/client";
import type { stripe } from "./index";
export const stripeClient = <

View File

@@ -1,7 +1,12 @@
import type { BetterAuthOptions } from "@better-auth/core";
import type { Auth, InferUser } from "better-auth";
import type { AuthClient } from "better-auth/client";
import { expectTypeOf, test } from "vitest";
test("expect imports", async () => {
expectTypeOf<AuthClient<{}>>().not.toBeUndefined();
});
test("infer user type correctly", async () => {
const config = {
user: {