@erquhart any idea how I can use
@erquhart any idea how I can use setUserPassword from better-auth admin?
16 Replies
looking at this
Are you sure you added the admin plugin to your createAuth?
@erquhart yessir
I am able to use it, but the types don't seem to be implemented
I'm running one of the examples with the admin plugin and the types are inferred correctly, eg., setUserPassword is there

What's wrong with mine then lol @erquhart

Hard to say, can you share the top of the file with imports and your file that defines createAuth?
Your return type is wiping out type inference
that'll do it
If i don't have that typescript freaks out at me
What error(s) are you seeing
The inferred type of 'createAuth' cannot be named without a reference to '.pnpm/zod@3.25.76/node_modules/zod'. This is likely not portable. A type annotation is necessary.ts(2742)
Ctrl+click to open in new tab
The inferred type of 'createAuth' cannot be named without a reference to '.pnpm/zod@4.0.14/node_modules/zod/v4/core'. This is likely not portable. A type annotation is necessary.ts(2742)
Ctrl+click to open in new tab
Exported variable 'createAuth' has or is using name 'SessionWithImpersonatedBy' from external module "/home/cole/Documents/mantis-os/node_modules/.pnpm/better-auth@1.3.3_react-dom@19.1.1_react@19.1.1react@19.1.1/node_modules/better-auth/dist/plugins/admin/index" but cannot be named.ts(4023)
Ctrl+click to open in new tab
Exported variable 'createAuth' has or is using name 'UserWithRole' from external module "/home/cole/Documents/mantis-os/node_modules/.pnpm/better-auth@1.3.3_react-dom@19.1.1_react@19.1.1react@19.1.1/node_modules/better-auth/dist/plugins/admin/index" but cannot be named.ts(4023)
Ctrl+click to open in new tab
The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.ts(7056)
pnpm is not happy
I probably have something seriously wrong with my typescript config / monorepo setup
maybe try deleting lockfile and node modules and reinstalling
will give that a shot
no luck...
now we have this...
GitHub
[Bug] [Bug] TS4023 error occurs after using the admin plugin · Iss...
Is this suited for github? Yes, this is suited for github To Reproduce auth.ts import { betterAuth } from 'better-auth' import { admin } from 'better-auth/plugins' export const auth...
Ah okay