bug: expo plugin TS error #1254

Closed
opened 2026-03-13 08:30:08 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @cluny85 on GitHub (May 23, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Following the documentation instructions on Expo integrations:

Image

Current vs. Expected behavior

TS returns the next error:

Type '{ id: "expo"; init: (ctx: AuthContext) => { options: { trustedOrigins: string[]; }; }; onRequest(request: Request, ctx: AuthContext): Promise<{ request: Request; } | undefined>; hooks: { ...; }; }' is not assignable to type 'BetterAuthPlugin'.
  Types of property 'init' are incompatible.
    Type '(ctx: AuthContext) => { options: { trustedOrigins: string[]; }; }' is not assignable to type '(ctx: AuthContext) => void | { context?: { trustedOrigins?: (string | undefined)[] | undefined; secret?: string | undefined; appName?: string | undefined; baseURL?: string | undefined; ... 15 more ...; runMigrations?: (() => Promise<...>) | undefined; } | undefined; options?: Partial<...> | undefined; }'.
      Types of parameters 'ctx' and 'ctx' are incompatible.
        Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.Cl08k4BO", { with: { "resolution-mode": "import" } }).l' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.ByRVnZKI").l'.
          The types of 'options.socialProviders' are incompatible between these types.
            Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.Bzjh9zg_", { with: { "resolution-mode": "import" } }).S | undefined' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth._rXvQlMG").S | undefined'.
              Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.Bzjh9zg_", { with: { "resolution-mode": "import" } }).S' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth._rXvQlMG").S'.
                Types of property 'vk' are incompatible.
                  Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/sh...' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth._rXvQlMG").a4 & { enabled?...'.
                    Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/sh...' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth._rXvQlMG").a4 & { enabled?...'.
                      Types of property 'lang_id' are incompatible.
                        Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.Bzjh9zg_", { with: { "resolution-mode": "import" } }).a3 | undefined' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth._rXvQlMG").a3 | undefined'.
                          Type 'LANG.RUS' is not assignable to type 'LANG | undefined'.

What version of Better Auth are you using?

1.2.8 for both libs

Provide environment information

- OS: Ubuntu 24
- TS: tsc
Dependencies:
"@types/node": "^22.15.18"
"typescript": "5.8.3"

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

Backend, Package, Types

Auth config (if applicable)

import { betterAuth } from "better-auth";
import { expo } from "@better-auth/expo";
 
export const auth = betterAuth({
    plugins: [expo()]
});

Additional context

No response

Originally created by @cluny85 on GitHub (May 23, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Following the documentation instructions on [Expo integrations](https://www.better-auth.com/docs/integrations/expo): ![Image](https://github.com/user-attachments/assets/77987d66-9707-45d6-a7c7-d0e1353c4d4d) ### Current vs. Expected behavior TS returns the next error: ``` Type '{ id: "expo"; init: (ctx: AuthContext) => { options: { trustedOrigins: string[]; }; }; onRequest(request: Request, ctx: AuthContext): Promise<{ request: Request; } | undefined>; hooks: { ...; }; }' is not assignable to type 'BetterAuthPlugin'. Types of property 'init' are incompatible. Type '(ctx: AuthContext) => { options: { trustedOrigins: string[]; }; }' is not assignable to type '(ctx: AuthContext) => void | { context?: { trustedOrigins?: (string | undefined)[] | undefined; secret?: string | undefined; appName?: string | undefined; baseURL?: string | undefined; ... 15 more ...; runMigrations?: (() => Promise<...>) | undefined; } | undefined; options?: Partial<...> | undefined; }'. Types of parameters 'ctx' and 'ctx' are incompatible. Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.Cl08k4BO", { with: { "resolution-mode": "import" } }).l' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.ByRVnZKI").l'. The types of 'options.socialProviders' are incompatible between these types. Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.Bzjh9zg_", { with: { "resolution-mode": "import" } }).S | undefined' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth._rXvQlMG").S | undefined'. Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.Bzjh9zg_", { with: { "resolution-mode": "import" } }).S' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth._rXvQlMG").S'. Types of property 'vk' are incompatible. Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/sh...' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth._rXvQlMG").a4 & { enabled?...'. Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.CYegVoq1", { with: { "resolution-mode": "import" } }).P<import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/sh...' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.CYegVoq1").P<import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth._rXvQlMG").a4 & { enabled?...'. Types of property 'lang_id' are incompatible. Type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth.Bzjh9zg_", { with: { "resolution-mode": "import" } }).a3 | undefined' is not assignable to type 'import(".../node_modules/.pnpm/better-auth@1.2.8/node_modules/better-auth/dist/shared/better-auth._rXvQlMG").a3 | undefined'. Type 'LANG.RUS' is not assignable to type 'LANG | undefined'. ``` ### What version of Better Auth are you using? 1.2.8 for both libs ### Provide environment information ```bash - OS: Ubuntu 24 - TS: tsc Dependencies: "@types/node": "^22.15.18" "typescript": "5.8.3" ``` ### Which area(s) are affected? (Select all that apply) Backend, Package, Types ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth"; import { expo } from "@better-auth/expo"; export const auth = betterAuth({ plugins: [expo()] }); ``` ### Additional context _No response_
Author
Owner

@Rffrench commented on GitHub (May 23, 2025):

how did you fix this @cluny85 ?

I had to use plugins: [expo() as any]

doesn't seem to be the best solution

@Rffrench commented on GitHub (May 23, 2025): how did you fix this @cluny85 ? I had to use `plugins: [expo() as any]` doesn't seem to be the best solution
Author
Owner

@cluny85 commented on GitHub (May 23, 2025):

how did you fix this @cluny85 ?

I had to use plugins: [expo() as any]

doesn't seem to be the best solution

@Rffrench I ran too fast opening the issue, I also did the same hack in the meantime.
But when I replicate it from 0 with just the minimum amount of dependencies, there's no TS error 😅

I use it in a monorepo with turbo, pnpm, server + expo, and no matter how I try to fix the dependencies, I still have the same issue.

I think I need more info to open the issue

@cluny85 commented on GitHub (May 23, 2025): > how did you fix this [@cluny85](https://github.com/cluny85) ? > > I had to use `plugins: [expo() as any]` > > doesn't seem to be the best solution @Rffrench I ran too fast opening the issue, I also did the same hack in the meantime. But when I replicate it from 0 with just the minimum amount of dependencies, there's no TS error 😅 I use it in a monorepo with turbo, pnpm, server + expo, and no matter how I try to fix the dependencies, I still have the same issue. I think I need more info to open the issue
Author
Owner

@IRediTOTO commented on GitHub (Jul 22, 2025):

I have same error but with stripe plugin

Type '{ id: "stripe"; endpoints: { stripeWebhook: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({ body?: undefined; } & { method?: "POST" | undefined; } & { query?: Record<string, any> | undefined; } & ... 4 more ... & { ...; }) | undefined): Promise<...>; options: { ...; } & ...' is not assignable to type 'BetterAuthPlugin'.
  Types of property 'init' are incompatible.
    Type '(ctx: AuthContext) => { options: { databaseHooks: { user: { create: { after(user: { id: string; email: string; emailVerified: boolean; name: string; createdAt: Date; updatedAt: Date; image?: string | ... 1 more ... | undefined; }, ctx: GenericEndpointContext | undefined): Promise<...>; }; }; }; }; }' is not assignable to type '(ctx: AuthContext) => void | { context?: { session?: { session?: { [x: string]: any; id?: string | undefined; userId?: string | undefined; expiresAt?: { toString?: (() => string) | undefined; ... 42 more ...; [Symbol.toPrimitive]?: { ...; } | undefined; } | undefined; ... 4 more ...; userAgent?: string | ... 1 more ...'.
      Types of parameters 'ctx' and 'ctx' are incompatible.
        Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.2lcgvW_O").p' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.Dj2HyOmw").p'.
          The types of 'options.socialProviders' are incompatible between these types.
            Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.PS9uuCnX").S | undefined' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.DPa2nz5L").S | undefined'.
              Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.PS9uuCnX").S' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.DPa2nz5L").S'.
                Types of property 'vk' are incompatible.
                  Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.ZSfSbnQT").a<import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-a...' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.ZSfSbnQT").a<import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-a...'.
                    Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.ZSfSbnQT").a<import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-a...' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.ZSfSbnQT").a<import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-a...'.
                      Types of property 'lang_id' are incompatible.
                        Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.PS9uuCnX").ac | undefined' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.DPa2nz5L").ac | undefined'.
                          Type 'LANG.RUS' is not assignable to type 'LANG | undefined'.

@IRediTOTO commented on GitHub (Jul 22, 2025): I have same error but with stripe plugin ``` Type '{ id: "stripe"; endpoints: { stripeWebhook: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({ body?: undefined; } & { method?: "POST" | undefined; } & { query?: Record<string, any> | undefined; } & ... 4 more ... & { ...; }) | undefined): Promise<...>; options: { ...; } & ...' is not assignable to type 'BetterAuthPlugin'. Types of property 'init' are incompatible. Type '(ctx: AuthContext) => { options: { databaseHooks: { user: { create: { after(user: { id: string; email: string; emailVerified: boolean; name: string; createdAt: Date; updatedAt: Date; image?: string | ... 1 more ... | undefined; }, ctx: GenericEndpointContext | undefined): Promise<...>; }; }; }; }; }' is not assignable to type '(ctx: AuthContext) => void | { context?: { session?: { session?: { [x: string]: any; id?: string | undefined; userId?: string | undefined; expiresAt?: { toString?: (() => string) | undefined; ... 42 more ...; [Symbol.toPrimitive]?: { ...; } | undefined; } | undefined; ... 4 more ...; userAgent?: string | ... 1 more ...'. Types of parameters 'ctx' and 'ctx' are incompatible. Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.2lcgvW_O").p' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.Dj2HyOmw").p'. The types of 'options.socialProviders' are incompatible between these types. Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.PS9uuCnX").S | undefined' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.DPa2nz5L").S | undefined'. Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.PS9uuCnX").S' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.DPa2nz5L").S'. Types of property 'vk' are incompatible. Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.ZSfSbnQT").a<import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-a...' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.ZSfSbnQT").a<import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-a...'. Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.ZSfSbnQT").a<import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-a...' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.ZSfSbnQT").a<import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-a...'. Types of property 'lang_id' are incompatible. Type 'import("/node_modules/.pnpm/better-auth@1.3.1_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.PS9uuCnX").ac | undefined' is not assignable to type 'import("/node_modules/.pnpm/better-auth@1.3.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/better-auth/dist/shared/better-auth.DPa2nz5L").ac | undefined'. Type 'LANG.RUS' is not assignable to type 'LANG | undefined'. ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1254