organizationClient incompatible type on Vue

I'm on a fresh quasar projects using Vite with pnpm workspace. My code is:
import { organizationClient } from 'better-auth/client/plugins'
import { createAuthClient } from 'better-auth/vue'

export const authClient = createAuthClient({
plugins: [
organizationClient(),
],
})
import { organizationClient } from 'better-auth/client/plugins'
import { createAuthClient } from 'better-auth/vue'

export const authClient = createAuthClient({
plugins: [
organizationClient(),
],
})
But I get the following type 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)
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)
1 Reply
jasperagrante
jasperagranteOP3mo ago
I've also tried on a non PNPM workspace quasar project and the error still occurs... Here's the tsconfig.json of quasar
{
"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": ["..."]
}
{
"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": ["..."]
}

Did you find this page helpful?