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
No description
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, ...
GitHub
Issues · better-auth/better-auth
The most comprehensive authentication framework for TypeScript - Issues · better-auth/better-auth
GitHub
rt-stack/apps/web/src/clients/authClient.ts at c9e2c654d5014389c82e...
Turborepo with modular components, shared configs, containerised deployments and 100% type-safety. - nktnet1/rt-stack
GitHub
The inferred type of 'auth' cannot be named without a reference · n...
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
rt-stack/packages/auth/src/client.ts at c9e2c654d5014389c82ed07b34b...
Turborepo with modular components, shared configs, containerised deployments and 100% type-safety. - nktnet1/rt-stack
Jump to solution
1 Reply
Solution
MrReinvent
MrReinvent6d ago
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 @repo/auth package, I export the Auth Client type: - https://github.com/nktnet1/rt-stack/blob/c9e2c654d5014389c82ed07b34b7dc316452f331/packages/auth/src/client.ts#L7 The type is then explicitly set when instantiating the auth client in my web application: - https://github.com/nktnet1/rt-stack/blob/c9e2c654d5014389c82ed07b34b7dc316452f331/apps/web/src/clients/authClient.ts#L4 --- This is not unique to better-auth - for example, next-auth has a similar thread, with a workaround: - https://github.com/nextauthjs/next-auth/discussions/9950#discussioncomment-9135791 whereby you tweak the tsconfig.json compilerOptions -> declaration:
{
"compilerOptions": {
"declaration": false,
}
}
{
"compilerOptions": {
"declaration": false,
}
}
although I would personally advise against this (see the linked thread for details).
GitHub
Issues · better-auth/better-auth
The most comprehensive authentication framework for TypeScript - Issues · better-auth/better-auth
GitHub
rt-stack/apps/web/src/clients/authClient.ts at c9e2c654d5014389c82e...
Turborepo with modular components, shared configs, containerised deployments and 100% type-safety. - nktnet1/rt-stack
GitHub
The inferred type of 'auth' cannot be named without a reference · n...
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
rt-stack/packages/auth/src/client.ts at c9e2c654d5014389c82ed07b34b...
Turborepo with modular components, shared configs, containerised deployments and 100% type-safety. - nktnet1/rt-stack

Did you find this page helpful?