[GH-ISSUE #6565] The inferred type of authClient cannot be named without a reference #19186

Closed
opened 2026-04-15 18:00:04 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @toshmukhamedov on GitHub (Dec 6, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/6565

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Create client using createAuthClient() including organizationClient() plugin
  2. Set "declaration": true and "moduleResolution": "bundler" in the tsconfig.json

Repo to reproduce: https://github.com/toshmukhamedov/better-auth-issue

Current vs. Expected behavior

When organizationClient() is included in the plugins array of createAuthClient, TypeScript fails with:

The inferred type of authClient cannot be named without a reference to apps/web/node_modules/better-auth/dist/index-V081dNa-.mjs. This is likely not portable. A type annotation is necessary. (ts 2742)

The error occurs only when: declaration: true and moduleResolution: bundler in tsconfig

Removing the plugin makes the error disappear.

What version of Better Auth are you using?

1.4.6-beta.3

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 25.1.0: Mon Oct 20 19:33:36 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6030",
    "release": "25.1.0",
    "cpuCount": 11,
    "cpuModel": "Apple M3 Pro",
    "totalMemory": "18.00 GB",
    "freeMemory": "0.82 GB"
  },
  "node": {
    "version": "v22.20.0",
    "env": "development"
  },
  "packageManager": {
    "name": "pnpm",
    "version": "10.22.0"
  },
  "frameworks": null,
  "databases": null,
  "betterAuth": {
    "version": "Unknown",
    "config": null
  }
}

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

Client

Auth config (if applicable)

export const authClient = createAuthClient({
  baseURL: import.meta.env.VITE_API_URL,
  basePath: "/api/auth",
  plugins: [
    adminClient(),
    organizationClient({
      teams: {
        enabled: true,
      },
    }),
  ],
});

Additional context

Image
Originally created by @toshmukhamedov on GitHub (Dec 6, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/6565 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Create client using `createAuthClient()` including `organizationClient()` plugin 2. Set `"declaration": true` and `"moduleResolution": "bundler"` in the tsconfig.json Repo to reproduce: https://github.com/toshmukhamedov/better-auth-issue ### Current vs. Expected behavior When organizationClient() is included in the plugins array of createAuthClient, TypeScript fails with: ```The inferred type of authClient cannot be named without a reference to apps/web/node_modules/better-auth/dist/index-V081dNa-.mjs. This is likely not portable. A type annotation is necessary. (ts 2742)``` The error occurs only when: declaration: true and moduleResolution: bundler in tsconfig Removing the plugin makes the error disappear. ### What version of Better Auth are you using? 1.4.6-beta.3 ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 25.1.0: Mon Oct 20 19:33:36 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6030", "release": "25.1.0", "cpuCount": 11, "cpuModel": "Apple M3 Pro", "totalMemory": "18.00 GB", "freeMemory": "0.82 GB" }, "node": { "version": "v22.20.0", "env": "development" }, "packageManager": { "name": "pnpm", "version": "10.22.0" }, "frameworks": null, "databases": null, "betterAuth": { "version": "Unknown", "config": null } } ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript export const authClient = createAuthClient({ baseURL: import.meta.env.VITE_API_URL, basePath: "/api/auth", plugins: [ adminClient(), organizationClient({ teams: { enabled: true, }, }), ], }); ``` ### Additional context <img width="839" height="503" alt="Image" src="https://github.com/user-attachments/assets/eb87dae6-c5ac-4fd4-a349-3c9ac73d773e" />
GiteaMirror added the locked label 2026-04-15 18:00:04 -05:00
Author
Owner

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

It looks like TypeScript is having trouble naming the inferred type when using the organizationClient plugin with the bundler module resolution and declaration mode enabled. A common workaround is to add an explicit type annotation to the authClient output so that the compiler doesn’t have to infer the complex type automatically [1]. You might also consider experimenting with your tsconfig settings—for example, temporarily disabling declaration or switching the moduleResolution to node to see if that resolves the issue. Have you tried any of these approaches, or would you like additional guidance on adding explicit type annotations? tag @better-auth-agent if you would like an answer from the Agent

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

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3620421793 --> @better-auth-agent[bot] commented on GitHub (Dec 6, 2025): It looks like TypeScript is having trouble naming the inferred type when using the organizationClient plugin with the bundler module resolution and declaration mode enabled. A common workaround is to add an explicit type annotation to the authClient output so that the compiler doesn’t have to infer the complex type automatically [[1]](https://github.com/better-auth/better-auth/issues/6446). You might also consider experimenting with your tsconfig settings—for example, temporarily disabling declaration or switching the moduleResolution to node to see if that resolves the issue. Have you tried any of these approaches, or would you like additional guidance on adding explicit type annotations? tag @better-auth-agent if you would like an answer from the Agent _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 6, 2025):

Hi @toshmukhamedov! I'm Dosu and I’m helping the better-auth team.

This is a known issue with better-auth when using plugins like organizationClient and strict TypeScript settings such as declaration: true and moduleResolution: bundler. The root cause is that the inferred type of authClient references internal module paths from node_modules, which TypeScript can't serialize into portable declaration files. This happens because the plugin types (especially organizationClient) use complex generics and conditional types that aren't re-exported as named types, so TypeScript tries to reference the internal build artifact instead, triggering TS2742 errors example.

Recent versions of better-auth (1.4.x and later) have addressed this by re-exporting plugin types and adding type helpers, making inferred types more portable and avoiding TS2742 PR 6490 PR 5827. If you're still seeing this error on 1.4.6-beta.3, try upgrading to the latest LTS version of better-auth and its plugins.

If you can't upgrade, workarounds include: using an explicit type annotation (e.g., export const authClient = createAuthClient(...) as ReturnType), disabling declaration and declarationMap in tsconfig (if you don't need declaration files), or moving your auth config to a separate package with declarations disabled workarounds. Note that explicit type annotations may lose plugin-specific typings, and disabling declaration prevents .d.ts file generation.

Let me know if you want a concrete code or tsconfig example for your setup.

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

<!-- gh-comment-id:3620425378 --> @dosubot[bot] commented on GitHub (Dec 6, 2025): <!-- Greeting --> Hi @toshmukhamedov! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This is a known issue with better-auth when using plugins like organizationClient and strict TypeScript settings such as declaration: true and moduleResolution: bundler. The root cause is that the inferred type of authClient references internal module paths from node_modules, which TypeScript can't serialize into portable declaration files. This happens because the plugin types (especially organizationClient) use complex generics and conditional types that aren't re-exported as named types, so TypeScript tries to reference the internal build artifact instead, triggering TS2742 errors [example](https://github.com/better-auth/better-auth/issues/5122). Recent versions of better-auth (1.4.x and later) have addressed this by re-exporting plugin types and adding type helpers, making inferred types more portable and avoiding TS2742 [PR 6490](https://github.com/better-auth/better-auth/pull/6490) [PR 5827](https://github.com/better-auth/better-auth/pull/5827). If you're still seeing this error on 1.4.6-beta.3, try upgrading to the latest LTS version of better-auth and its plugins. If you can't upgrade, workarounds include: using an explicit type annotation (e.g., export const authClient = createAuthClient(...) as ReturnType<typeof createAuthClient>), disabling declaration and declarationMap in tsconfig (if you don't need declaration files), or moving your auth config to a separate package with declarations disabled [workarounds](https://github.com/better-auth/better-auth/issues/5574#issuecomment-3446733444). Note that explicit type annotations may lose plugin-specific typings, and disabling declaration prevents .d.ts file generation. Let me know if you want a concrete code or tsconfig example for your setup. <!-- 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/53322bf4-10ea-4a51-bd58-de96a2306c37?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/53322bf4-10ea-4a51-bd58-de96a2306c37?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/53322bf4-10ea-4a51-bd58-de96a2306c37?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/53322bf4-10ea-4a51-bd58-de96a2306c37?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/53322bf4-10ea-4a51-bd58-de96a2306c37?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/53322bf4-10ea-4a51-bd58-de96a2306c37?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/53322bf4-10ea-4a51-bd58-de96a2306c37?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%20with%20better-auth%20when%20using%20plugins%20like%20organizationClient%20and%20strict%20TypeScript%20settings%20such%20as%20declaration%3A%20true%20and%20moduleResolution%3A%20bundler.%20The%20root%20cause%20is%20that%20the%20inferred%20type%20of%20authClient%20references%20internal%20module%20paths%20from%20node_modules%2C%20which%20TypeScript%20can%27t%20serialize%20into%20portable%20declaration%20files.%20This%20happens%20because%20the%20plugin%20types%20%28especially%20organizationClient%29%20use%20complex%20generics%20and%20conditional%20types%20that%20aren%27t%20re-exported%20as%20named%20types%2C%20so%20TypeScript%20tries%20to%20reference%20the%20internal%20build%20artifact%20instead%2C%20triggering%20TS2742%20errors%C2%A0%5Bexample%5D%28https%3A//github.com/better-auth/better-auth/issues/5122%29.%0A%0ARecent%20versions%20of%20better-auth%20%281.4.x%20and%20later%29%20have%20addressed%20this%20by%20re-exporting%20plugin%20types%20and%20adding%20type%20helpers%2C%20making%20inferred%20types%20more%20portable%20and%20avoiding%20TS2742%C2%A0%5BPR%206490%5D%28https%3A//github.com/better-auth/better-auth/pull/6490%29%C2%A0%5BPR%205827%5D%28https%3A//github.com/better-auth/better-auth/pull/5827%29.%20If%20you%27re%20still%20seeing%20this%20error%20on%201.4.6-beta.3%2C%20try%20upgrading%20to%20the%20latest%20LTS%20version%20of%20better-auth%20and%20its%20plugins.%0A%0AIf%20you%20can%27t%20upgrade%2C%20workarounds%20include%3A%20using%20an%20explicit%20type%20annotation%20%28e.g.%2C%20export%20const%20authClient%20%3D%20createAuthClient%28...%29%20as%20ReturnType%3Ctypeof%20createAuthClient%3E%29%2C%20disabling%20declaration%20and%20declarationMap%20in%20tsconfig%20%28if%20you%20don%27t%20need%20declaration%20files%29%2C%20or%20moving%20your%20auth%20config%20to%20a%20separate%20package%20with%20declarations%20disabled%C2%A0%5Bworkarounds%5D%28https%3A//github.com/better-auth/better-auth/issues/5574%23issuecomment-3446733444%29.%20Note%20that%20explicit%20type%20annotations%20may%20lose%20plugin-specific%20typings%2C%20and%20disabling%20declaration%20prevents%20.d.ts%20file%20generation.%0A%0ALet%20me%20know%20if%20you%20want%20a%20concrete%20code%20or%20tsconfig%20example%20for%20your%20setup.)&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/6565)
Author
Owner

@toshmukhamedov commented on GitHub (Dec 28, 2025):

This is happening again, but this time only when I use additionalFields with the organizationClient plugin.
Removing additionalFields fixes the error.

Config:

export const authClient = createAuthClient({
  baseURL: import.meta.env.VITE_API_URL,
  basePath: "/api/user/auth",
  plugins: [
    adminClient(),
    organizationClient({
      teams: {
        enabled: true,
      },
      schema: {
        organization: {
          additionalFields: {
            publicId: {
              type: "string",
              input: false,
            },
          },
        },
      },
    }),
  ],
});

@dosu

<!-- gh-comment-id:3694515917 --> @toshmukhamedov commented on GitHub (Dec 28, 2025): This is happening again, but this time only when I use `additionalFields` with the `organizationClient` plugin. Removing `additionalFields` fixes the error. #### Config: ```ts export const authClient = createAuthClient({ baseURL: import.meta.env.VITE_API_URL, basePath: "/api/user/auth", plugins: [ adminClient(), organizationClient({ teams: { enabled: true, }, schema: { organization: { additionalFields: { publicId: { type: "string", input: false, }, }, }, }, }), ], }); ``` @dosu
Author
Owner

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

This TS2742 error happens because when you use additionalFields in the organizationClient plugin, TypeScript tries to infer types that reference internal/private types from the better-auth package (like DBFieldAttribute and InferAdditionalFieldsFromPluginOptions). These aren't exported as public types, so TypeScript can't serialize them into portable declaration files—especially with declaration: true and moduleResolution: bundler enabled. Removing additionalFields avoids this complex inference, so the error disappears details code reference.

Workarounds:

  • Use the inferOrgAdditionalFields utility when passing the schema to organizationClient. This helps TypeScript infer the type in a more portable way and can avoid TS2742 in some setups example:

    import { inferOrgAdditionalFields, organizationClient } from "better-auth/client/plugins";
    import type { auth } from "./auth"; // your server-side auth config
    
    export const authClient = createAuthClient({
      baseURL: import.meta.env.VITE_API_URL,
      basePath: "/api/user/auth",
      plugins: [
        adminClient(),
        organizationClient({
          teams: { enabled: true },
          schema: inferOrgAdditionalFields<typeof auth>(),
        }),
      ],
    });
    
  • If your client and server are in separate projects, manually duplicate the organization schema and use inferOrgAdditionalFields({ organization: { additionalFields: ... } }) docs.

  • Disable declaration and declarationMap in your tsconfig if you don't need .d.ts files thread.

  • Set exactOptionalPropertyTypes: false in your tsconfig. This is known to resolve similar errors, though it reduces type strictness thread.

  • Explicit type annotations (e.g., as ReturnType<typeof createAuthClient>) can suppress the error, but you may lose plugin-specific typings thread.

Note: This is a known limitation with complex plugin schemas in better-auth. Most users with strict TypeScript settings and declaration enabled end up using one of these workarounds until a more robust type export system is implemented.

Let me know if you want a concrete example for your exact setup or need help with a specific workaround.

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

<!-- gh-comment-id:3694518764 --> @dosubot[bot] commented on GitHub (Dec 28, 2025): <!-- Answer --> This TS2742 error happens because when you use `additionalFields` in the `organizationClient` plugin, TypeScript tries to infer types that reference internal/private types from the better-auth package (like `DBFieldAttribute` and `InferAdditionalFieldsFromPluginOptions`). These aren't exported as public types, so TypeScript can't serialize them into portable declaration files—especially with `declaration: true` and `moduleResolution: bundler` enabled. Removing `additionalFields` avoids this complex inference, so the error disappears [details](https://github.com/better-auth/better-auth/issues/5122) [code reference](https://github.com/better-auth/better-auth/blob/4d7d7d5a76b5e0e90d42238f00751584ec07afa7/packages/better-auth/src/plugins/organization/client.ts#L45-L321). **Workarounds:** - Use the `inferOrgAdditionalFields` utility when passing the schema to `organizationClient`. This helps TypeScript infer the type in a more portable way and can avoid TS2742 in some setups [example](https://github.com/better-auth/better-auth/pull/3612): ```ts import { inferOrgAdditionalFields, organizationClient } from "better-auth/client/plugins"; import type { auth } from "./auth"; // your server-side auth config export const authClient = createAuthClient({ baseURL: import.meta.env.VITE_API_URL, basePath: "/api/user/auth", plugins: [ adminClient(), organizationClient({ teams: { enabled: true }, schema: inferOrgAdditionalFields<typeof auth>(), }), ], }); ``` - If your client and server are in separate projects, manually duplicate the organization schema and use `inferOrgAdditionalFields({ organization: { additionalFields: ... } })` [docs](https://github.com/better-auth/better-auth/pull/3564). - Disable `declaration` and `declarationMap` in your tsconfig if you don't need .d.ts files [thread](https://github.com/better-auth/better-auth/issues/766). - Set `exactOptionalPropertyTypes: false` in your tsconfig. This is known to resolve similar errors, though it reduces type strictness [thread](https://github.com/better-auth/better-auth/issues/2471). - Explicit type annotations (e.g., `as ReturnType<typeof createAuthClient>`) can suppress the error, but you may lose plugin-specific typings [thread](https://github.com/better-auth/better-auth/issues/1391). **Note:** This is a known limitation with complex plugin schemas in better-auth. Most users with strict TypeScript settings and declaration enabled end up using one of these workarounds until a more robust type export system is implemented. Let me know if you want a concrete example for your exact setup or need help with a specific workaround. <!-- 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/e7045fd3-f820-4ecc-9cb0-dd81b86265c4?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/e7045fd3-f820-4ecc-9cb0-dd81b86265c4?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/e7045fd3-f820-4ecc-9cb0-dd81b86265c4?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/e7045fd3-f820-4ecc-9cb0-dd81b86265c4?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e7045fd3-f820-4ecc-9cb0-dd81b86265c4?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/e7045fd3-f820-4ecc-9cb0-dd81b86265c4?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e7045fd3-f820-4ecc-9cb0-dd81b86265c4?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%20TS2742%20error%20happens%20because%20when%20you%20use%20%60additionalFields%60%20in%20the%20%60organizationClient%60%20plugin%2C%20TypeScript%20tries%20to%20infer%20types%20that%20reference%20internal/private%20types%20from%20the%20better-auth%20package%20%28like%20%60DBFieldAttribute%60%20and%20%60InferAdditionalFieldsFromPluginOptions%60%29.%20These%20aren%27t%20exported%20as%20public%20types%2C%20so%20TypeScript%20can%27t%20serialize%20them%20into%20portable%20declaration%20files%E2%80%94especially%20with%20%60declaration%3A%20true%60%20and%20%60moduleResolution%3A%20bundler%60%20enabled.%20Removing%20%60additionalFields%60%20avoids%20this%20complex%20inference%2C%20so%20the%20error%20disappears%C2%A0%5Bdetails%5D%28https%3A//github.com/better-auth/better-auth/issues/5122%29%C2%A0%5Bcode%20reference%5D%28https%3A//github.com/better-auth/better-auth/blob/4d7d7d5a76b5e0e90d42238f00751584ec07afa7/packages/better-auth/src/plugins/organization/client.ts%23L45-L321%29.%0A%0A%2A%2AWorkarounds%3A%2A%2A%0A%0A-%20Use%20the%20%60inferOrgAdditionalFields%60%20utility%20when%20passing%20the%20schema%20to%20%60organizationClient%60.%20This%20helps%20TypeScript%20infer%20the%20type%20in%20a%20more%20portable%20way%20and%20can%20avoid%20TS2742%20in%20some%20setups%C2%A0%5Bexample%5D%28https%3A//github.com/better-auth/better-auth/pull/3612%29%3A%0A%0A%20%20%60%60%60ts%0A%20%20import%20%7B%20inferOrgAdditionalFields%2C%20organizationClient%20%7D%20from%20%22better-auth/client/plugins%22%3B%0A%20%20import%20type%20%7B%20auth%20%7D%20from%20%22./auth%22%3B%20//%20your%20server-side%20auth%20config%0A%0A%20%20export%20const%20authClient%20%3D%20createAuthClient%28%7B%0A%20%20%20%20baseURL%3A%20import.meta.env.VITE_API_URL%2C%0A%20%20%20%20basePath%3A%20%22/api/user/auth%22%2C%0A%20%20%20%20plugins%3A%20%5B%0A%20%20%20%20%20%20adminClient%28%29%2C%0A%20%20%20%20%20%20organizationClient%28%7B%0A%20%20%20%20%20%20%20%20teams%3A%20%7B%20enabled%3A%20true%20%7D%2C%0A%20%20%20%20%20%20%20%20schema%3A%20inferOrgAdditionalFields%3Ctypeof%20auth%3E%28%29%2C%0A%20%20%20%20%20%20%7D%29%2C%0A%20%20%20%20%5D%2C%0A%20%20%7D%29%3B%0A%20%20%60%60%60%0A%0A-%20If%20your%20client%20and%20server%20are%20in%20separate%20projects%2C%20manually%20duplicate%20the%20organization%20schema%20and%20use%20%60inferOrgAdditionalFields%28%7B%20organization%3A%20%7B%20additionalFields%3A%20...%20%7D%20%7D%29%60%C2%A0%5Bdocs%5D%28https%3A//github.com/better-auth/better-auth/pull/3564%29.%0A%0A-%20Disable%20%60declaration%60%20and%20%60declarationMap%60%20in%20your%20tsconfig%20if%20you%20don%27t%20need%20.d.ts%20files%C2%A0%5Bthread%5D%28https%3A//github.com/better-auth/better-auth/issues/766%29.%0A%0A-%20Set%20%60exactOptionalPropertyTypes%3A%20false%60%20in%20your%20tsconfig.%20This%20is%20known%20to%20resolve%20similar%20errors%2C%20though%20it%20reduces%20type%20strictness%C2%A0%5Bthread%5D%28https%3A//github.com/better-auth/better-auth/issues/2471%29.%0A%0A-%20Explicit%20type%20annotations%20%28e.g.%2C%20%60as%20ReturnType%3Ctypeof%20createAuthClient%3E%60%29%20can%20suppress%20the%20error%2C%20but%20you%20may%20lose%20plugin-specific%20typings%C2%A0%5Bthread%5D%28https%3A//github.com/better-auth/better-auth/issues/1391%29.%0A%0A%2A%2ANote%3A%2A%2A%20This%20is%20a%20known%20limitation%20with%20complex%20plugin%20schemas%20in%20better-auth.%20Most%20users%20with%20strict%20TypeScript%20settings%20and%20declaration%20enabled%20end%20up%20using%20one%20of%20these%20workarounds%20until%20a%20more%20robust%20type%20export%20system%20is%20implemented.%0A%0ALet%20me%20know%20if%20you%20want%20a%20concrete%20example%20for%20your%20exact%20setup%20or%20need%20help%20with%20a%20specific%20workaround.)&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/6565)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#19186