Creating declaration files results in too long type

Hi, I'm currently using Hono RPC and want to export my Router as a type for the frontend. The problem I'm facing is that when I'm compiling the declaration files to relieve tsserver of inferring them, it crashes with this error message.
src/lib/auth.ts:18:14 - error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.

18 export const auth = betterAuth({
~~~~

[11:24:50 PM] Found 1 error. Watching for file changes.
src/lib/auth.ts:18:14 - error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.

18 export const auth = betterAuth({
~~~~

[11:24:50 PM] Found 1 error. Watching for file changes.
I'm currently using the admin, organization, magicLink, passKey and twoFactor Plugins and a prisma adapter with postgres Is this known, can I fix this somehow? Thanks in advance!
3 Replies
bekacru
bekacru3w ago
my recommendation currently, disable declartion from tsconfig and use tsup or other bunder to generate the decalration file instead.
lambert
lambertOP3w ago
tsup had the same problem, I "fixed" it with removing the passkey Plugin I don’t think it’s really the culprit, just that it’s type probably pushed it over the limit
bekacru
bekacru3w ago
It should probably be addressed on 1.2. You can try rc on better-auth@beta

Did you find this page helpful?