Inferred type of betterAuth client exceed compiler serialization
Hi,
Im getting this typescript error in my project. Any suggestion on how to solve it?
`The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.``
11 Replies
Anyone stumbled into the same issue? 🤔
have you enabled
strict
in tsconfig? @discquist
https://www.better-auth.com/docs/concepts/typescript#strict-modeTypeScript | Better Auth
Better Auth TypeScript integration.
Yes that's enabled
Is there any type i can vast the betterAuth isntance as? That would probably help, but couldn't find.
Same error for me
Normally this solves it. Can I see your entire tsconfig?
for me it's
and base.json
Check if you disable declaration if it will work
seem to work thank you 🙏
Hello, @discquist , could you try disabling
declaration
as well?Yeah i'll try that.But unsure if i want to do that since i use a ackend framework (encore.ts) that allows me to generate fully typed client to consume in my frontend.
@Ping Yeah, not possilbe for me to disbale declaration in my projet. So i htink one solution would be if i can set the type of the instance or something?
You can set it to
ReturnType<typeof betterAuth>
, but you won't get any inference for any plugins or other configurations you may have added.