Skip to content

Commit d5c69f9

Browse files
committed
Fix User type
1 parent f9bec9d commit d5c69f9

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/next-auth.d.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import type { DefaultSession } from 'next-auth'
1+
import 'next-auth'
2+
import { UserRoles } from './db/constants/users'
23

34
declare module 'next-auth' {
5+
interface User {
6+
role: UserRoles
7+
}
48
interface Session {
5-
user: {
6-
id: string
7-
email: string
8-
image: Required<DefaultSession>['user']['image']
9-
name: Required<DefaultSession>['user']['name']
10-
}
9+
user: User
1110
}
1211
}
1312

src/server/auth.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,10 @@ import GoogleProvider from 'next-auth/providers/google'
88
import { env } from '~/env.mjs'
99
import { loginSchema } from '~/schemas/auth'
1010
import { updateSessionSchema } from '~/schemas/profile'
11-
import { UserRoles } from './db/constants/users'
1211
import { db } from './db/db'
1312
import { users } from './db/schema'
1413
import { CustomAdapter } from './helpers/auth/custom-adapter'
1514

16-
declare module 'next-auth' {
17-
interface User {
18-
role: UserRoles
19-
}
20-
}
21-
2215
export const authOptions: AuthOptions = {
2316
adapter: CustomAdapter,
2417
providers: [

0 commit comments

Comments
 (0)