The inferred type of 'authClient' cannot be named without a reference...

I was trying to create a shared auth client package in my monorepo, since I have multiple frontends authenticating with the same server..
But I keep getting an error like this (twice) even before adding any plugins...
Literally.. this is my entire code:
import { createAuthClient } from "better-auth/client";

export const authClient = (baseURL: string) => {
  return createAuthClient({
    baseURL,
  });
};


I can't disable declaration in my tsconfig, since it's a shared package in my monorepo, and I need the type safety.
I can't add an explicit return type like ReturnType<typeof createAuthClient> since that ruins type safety for any plugins I might add..

Is this a bug in better-auth? Or did I get something wrong with the configuration
Was this page helpful?