[GH-ISSUE #3079] Property 'team' is incompatible with index signature #9466

Closed
opened 2026-04-13 04:56:23 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @captainjapeng on GitHub (Jun 19, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/3079

Originally assigned to: @ping-maxwell on GitHub.

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

import { organizationClient } from 'better-auth/client/plugins'
import { createAuthClient } from 'better-auth/vue'

export const authClient = createAuthClient({
  plugins: [
    organizationClient(),
  ],
})

Current vs. Expected behavior

It should work out of the box, instead I get the following error.

Type '{ id: "organization"; $InferServerPlugin: { id: "organization"; endpoints: { createOrganization: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: { body: { name: string; slug: string; userId?: string | undefined; metadata?: Record<...> | undefined; logo?: string | undefined; ...' is not assignable to type 'BetterAuthClientPlugin'.
  The types of '$InferServerPlugin.schema' are incompatible between these types.
    Type '{ team?: { modelName: string | undefined; fields: { name: { type: "string"; required: true; fieldName: string | undefined; }; organizationId: { type: "string"; required: true; references: { model: string; field: string; }; fieldName: string | undefined; }; createdAt: { ...; }; updatedAt: { ...; }; }; } | undefined; ...' is not assignable to type 'AuthPluginSchema'.
      Property 'team' is incompatible with index signature.
        Type '{ modelName: string | undefined; fields: { name: { type: "string"; required: true; fieldName: string | undefined; }; organizationId: { type: "string"; required: true; references: { model: string; field: string; }; fieldName: string | undefined; }; createdAt: { ...; }; updatedAt: { ...; }; }; } | undefined' is not assignable to type '{ fields: { [x: string]: FieldAttribute<FieldType>; }; disableMigration?: boolean; modelName?: string; }'.
          Type 'undefined' is not assignable to type '{ fields: { [x: string]: FieldAttribute<FieldType>; }; disableMigration?: boolean; modelName?: string; }'.ts(2322)

What version of Better Auth are you using?

1.2.9

Provide environment information

- Windows 10
- Chrome
- Vue
- Quasar
- With and Without PNPM Workspaces

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

Client

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

Here's my tsconfig.json

{
  "compilerOptions": {
    "esModuleInterop": true,
    "skipLibCheck": true,
    "target": "esnext",
    "allowJs": true,
    "resolveJsonModule": true,
    "moduleDetection": "force",
    "isolatedModules": true,
    "module": "preserve",
    "noEmit": true,
    "lib": [
      "esnext",
      "dom",
      "dom.iterable"
    ],
    "strict": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "noImplicitOverride": true,
    "exactOptionalPropertyTypes": true,
    "noUncheckedIndexedAccess": true,
    "paths": { /* ... */ }
  },
  "include": ["..."],
  "exclude": ["..."]
}

I've also posted this on discord but was not able to get any reply:
https://discord.com/channels/1288403910284935179/1384585148728741956

Originally created by @captainjapeng on GitHub (Jun 19, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/3079 Originally assigned to: @ping-maxwell on GitHub. ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce ```ts import { organizationClient } from 'better-auth/client/plugins' import { createAuthClient } from 'better-auth/vue' export const authClient = createAuthClient({ plugins: [ organizationClient(), ], }) ``` ### Current vs. Expected behavior It should work out of the box, instead I get the following error. ``` Type '{ id: "organization"; $InferServerPlugin: { id: "organization"; endpoints: { createOrganization: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: { body: { name: string; slug: string; userId?: string | undefined; metadata?: Record<...> | undefined; logo?: string | undefined; ...' is not assignable to type 'BetterAuthClientPlugin'. The types of '$InferServerPlugin.schema' are incompatible between these types. Type '{ team?: { modelName: string | undefined; fields: { name: { type: "string"; required: true; fieldName: string | undefined; }; organizationId: { type: "string"; required: true; references: { model: string; field: string; }; fieldName: string | undefined; }; createdAt: { ...; }; updatedAt: { ...; }; }; } | undefined; ...' is not assignable to type 'AuthPluginSchema'. Property 'team' is incompatible with index signature. Type '{ modelName: string | undefined; fields: { name: { type: "string"; required: true; fieldName: string | undefined; }; organizationId: { type: "string"; required: true; references: { model: string; field: string; }; fieldName: string | undefined; }; createdAt: { ...; }; updatedAt: { ...; }; }; } | undefined' is not assignable to type '{ fields: { [x: string]: FieldAttribute<FieldType>; }; disableMigration?: boolean; modelName?: string; }'. Type 'undefined' is not assignable to type '{ fields: { [x: string]: FieldAttribute<FieldType>; }; disableMigration?: boolean; modelName?: string; }'.ts(2322) ``` ### What version of Better Auth are you using? 1.2.9 ### Provide environment information ```bash - Windows 10 - Chrome - Vue - Quasar - With and Without PNPM Workspaces ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context Here's my tsconfig.json ```json { "compilerOptions": { "esModuleInterop": true, "skipLibCheck": true, "target": "esnext", "allowJs": true, "resolveJsonModule": true, "moduleDetection": "force", "isolatedModules": true, "module": "preserve", "noEmit": true, "lib": [ "esnext", "dom", "dom.iterable" ], "strict": true, "allowUnreachableCode": false, "allowUnusedLabels": false, "noImplicitOverride": true, "exactOptionalPropertyTypes": true, "noUncheckedIndexedAccess": true, "paths": { /* ... */ } }, "include": ["..."], "exclude": ["..."] } ``` I've also posted this on discord but was not able to get any reply: https://discord.com/channels/1288403910284935179/1384585148728741956
GiteaMirror added the locked label 2026-04-13 04:56:23 -05:00
Author
Owner

@ping-maxwell commented on GitHub (Jul 1, 2025):

You need to enable teams in the client auth:

		organizationClient({ teams: { enabled: true } }),

also, you may have forgotten to include organization in your auth config plugins list too.

<!-- gh-comment-id:3021688196 --> @ping-maxwell commented on GitHub (Jul 1, 2025): You need to enable teams in the client auth: ```ts organizationClient({ teams: { enabled: true } }), ``` also, you may have forgotten to include `organization` in your auth config plugins list too.
Author
Owner

@timReynolds commented on GitHub (Jul 16, 2025):

This seems broken on both client and server, when I tried to use the plugin on the server I get a similar error;

Type '{ id: "organization"; endpoints: { createOrganization: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: { body: { name: string; slug: string; userId?: string | undefined; metadata?: Record<string, any> | undefined; logo?: string | undefined; keepCurrentActiveOrganization?: bo...' is not assignable to type 'BetterAuthPlugin'.
  Types of property 'schema' are incompatible.
    Type '{ team?: { modelName: string | undefined; fields: { name: { type: "string"; required: true; fieldName: string | undefined; }; organizationId: { type: "string"; required: true; references: { model: string; field: string; }; fieldName: string | undefined; }; createdAt: { ...; }; updatedAt: { ...; }; }; } | undefined; ...' is not assignable to type 'AuthPluginSchema'.
      Property 'team' is incompatible with index signature.
        Type '{ modelName: string | undefined; fields: { name: { type: "string"; required: true; fieldName: string | undefined; }; organizationId: { type: "string"; required: true; references: { model: string; field: string; }; fieldName: string | undefined; }; createdAt: { ...; }; updatedAt: { ...; }; }; } | undefined' is not assignable to type '{ fields: { [x: string]: FieldAttribute<FieldType>; }; disableMigration?: boolean; modelName?: string; }'.
          Type 'undefined' is not assignable to type '{ fields: { [x: string]: FieldAttribute<FieldType>; }; disableMigration?: boolean; modelName?: string; }

By default teams is turned off but this happens when you load the plugin without enabling teams

<!-- gh-comment-id:3079464972 --> @timReynolds commented on GitHub (Jul 16, 2025): This seems broken on both client and server, when I tried to use the plugin on the server I get a similar error; ``` Type '{ id: "organization"; endpoints: { createOrganization: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: { body: { name: string; slug: string; userId?: string | undefined; metadata?: Record<string, any> | undefined; logo?: string | undefined; keepCurrentActiveOrganization?: bo...' is not assignable to type 'BetterAuthPlugin'. Types of property 'schema' are incompatible. Type '{ team?: { modelName: string | undefined; fields: { name: { type: "string"; required: true; fieldName: string | undefined; }; organizationId: { type: "string"; required: true; references: { model: string; field: string; }; fieldName: string | undefined; }; createdAt: { ...; }; updatedAt: { ...; }; }; } | undefined; ...' is not assignable to type 'AuthPluginSchema'. Property 'team' is incompatible with index signature. Type '{ modelName: string | undefined; fields: { name: { type: "string"; required: true; fieldName: string | undefined; }; organizationId: { type: "string"; required: true; references: { model: string; field: string; }; fieldName: string | undefined; }; createdAt: { ...; }; updatedAt: { ...; }; }; } | undefined' is not assignable to type '{ fields: { [x: string]: FieldAttribute<FieldType>; }; disableMigration?: boolean; modelName?: string; }'. Type 'undefined' is not assignable to type '{ fields: { [x: string]: FieldAttribute<FieldType>; }; disableMigration?: boolean; modelName?: string; } ``` By default teams is turned off but this happens when you load the plugin without enabling teams
Author
Owner

@chrisui commented on GitHub (Jul 16, 2025):

Same error @1.2.12 (both react client and server). TS @5.8.3

<!-- gh-comment-id:3079635648 --> @chrisui commented on GitHub (Jul 16, 2025): Same error @1.2.12 (both react client and server). TS @5.8.3
Author
Owner

@petrbela commented on GitHub (Jul 24, 2025):

Just like @timReynolds, I'm getting the typescript error in auth.ts when strict: true and haven't enabled teams... better-auth v1.3.3

Image
<!-- gh-comment-id:3113589361 --> @petrbela commented on GitHub (Jul 24, 2025): Just like @timReynolds, I'm getting the typescript error in `auth.ts` when `strict: true` and haven't enabled teams... better-auth v1.3.3 <img width="1534" height="682" alt="Image" src="https://github.com/user-attachments/assets/01c54241-bc67-48da-860a-1e3d6ef3e919" />
Author
Owner

@timReynolds commented on GitHub (Jul 24, 2025):

Tested with 1.3.0 also which is still broken

<!-- gh-comment-id:3113837829 --> @timReynolds commented on GitHub (Jul 24, 2025): Tested with 1.3.0 also which is still broken
Author
Owner

@timReynolds commented on GitHub (Jul 27, 2025):

This is caused by the ts option exactOptionalPropertyTypes being set to true. If you remove it set it to false you’ll no longer experience this error

<!-- gh-comment-id:3124759185 --> @timReynolds commented on GitHub (Jul 27, 2025): This is caused by the ts option exactOptionalPropertyTypes being set to true. If you remove it set it to false you’ll no longer experience this error
Author
Owner

@Kinfe123 commented on GitHub (Aug 14, 2025):

It should be fixed on the latest patch release.

<!-- gh-comment-id:3189855597 --> @Kinfe123 commented on GitHub (Aug 14, 2025): It should be fixed on the latest patch release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9466