The inferred type of 'authClient' cannot be named without a reference to '.pnpm/@better-fetch+fetch@
Encountering Error in Turbo Repo Project – Need Help Resolving It

Solution
This is a known issue (see better-auth issue #1391)
Your choices (if you don't want to tweak your tsconfig or wait until this is fixed upstream) are usually to install the inner types in the consuming package, or export your own types from your internal package and re-use it in the consumer.
Neither are ideal, but I went with the second. For example,
In my
The type is then explicitly set when instantiating the auth client in my
---
This is not unique to better-auth - for example, next-auth has a similar thread, with a workaround:
whereby you tweak the
although I would personally advise against this (see the linked thread for details).
Your choices (if you don't want to tweak your tsconfig or wait until this is fixed upstream) are usually to install the inner types in the consuming package, or export your own types from your internal package and re-use it in the consumer.
Neither are ideal, but I went with the second. For example,
In my
@repo/auth package, I export the Auth Client type:The type is then explicitly set when instantiating the auth client in my
web application:---
This is not unique to better-auth - for example, next-auth has a similar thread, with a workaround:
whereby you tweak the
tsconfig.json compilerOptions -> declaration:although I would personally advise against this (see the linked thread for details).
GitHub
The most comprehensive authentication framework for TypeScript - Issues · better-auth/better-auth
GitHub
Turborepo with modular components, shared configs, containerised deployments and 100% type-safety. - nktnet1/rt-stack
GitHub
hey folks, I am trying to upgrade the setup to V5 with a very basic auth file (I commented the code to test it out), TypeScript compiler is giving me some trouble: import NextAuth, { NextAuthConfig...
GitHub
Turborepo with modular components, shared configs, containerised deployments and 100% type-safety. - nktnet1/rt-stack