@@ -100,7 +100,7 @@ declare module '#auth/secondary-storage' {
100100 getContents : ( ) => `
101101// Type augmentation support
102102export * from '${ resolver . resolve ( './runtime/types/augment' ) } '
103- export type { AuthMeta, AuthMode, AuthRouteRules, UserMatch, RequireSessionOptions } from '${ resolver . resolve ( './runtime/types' ) } '
103+ export type { AuthMeta, AuthMode, AuthRouteRules, UserMatch, RequireSessionOptions, Auth, InferUser, InferSession } from '${ resolver . resolve ( './runtime/types' ) } '
104104` ,
105105 } )
106106
@@ -110,13 +110,18 @@ export type { AuthMeta, AuthMode, AuthRouteRules, UserMatch, RequireSessionOptio
110110 getContents : ( ) => `
111111// Auto-generated types from auth.config.ts
112112import type { InferUser, InferSession } from 'better-auth'
113+ import type { RuntimeConfig } from 'nuxt/schema'
113114import type configFn from '${ serverConfigPath } '
114115
115116type _Config = ReturnType<typeof configFn>
116117
117118declare module '#nuxt-better-auth' {
118119 interface AuthUser extends InferUser<_Config> {}
119120 interface AuthSession { session: InferSession<_Config>['session'], user: InferUser<_Config> }
121+ interface ServerAuthContext {
122+ runtimeConfig: RuntimeConfig
123+ ${ hasDb ? `db: typeof import('hub:db')['db']` : '' }
124+ }
120125}
121126` ,
122127 } )
@@ -270,4 +275,4 @@ async function setupBetterAuthSchema(nuxt: any, serverConfigPath: string) {
270275
271276// Re-export config helpers
272277export { defineClientAuth , defineServerAuth } from './runtime/config'
273- export type { AuthMeta , AuthMode , AuthRouteRules , AuthSession , AuthUser , RequireSessionOptions , UserMatch } from './runtime/types'
278+ export type { Auth , AuthMeta , AuthMode , AuthRouteRules , AuthSession , AuthUser , InferSession , InferUser , RequireSessionOptions , ServerAuthContext , UserMatch } from './runtime/types'
0 commit comments