Property 'handle' does not exist on type '{}'

How do i bypass "Property 'handle' does not exist on type '{}'" i am trying to pass the handle value to the session, and the handle value in fact exists in token.user and my code works accordingly as well, however typescript does not let me pass through this error. my code is as follows (this is inside the [nextauth].ts file)
callbacks: {
jwt: async ({ token, user }) => {
if (user) {
token.user = user;
}
return Promise.resolve(token);
},
session({ session, token }) {
if(token.user){
session.user = {
id: token.sub || "",
handle: token.user.handle, <-- here
email: token.email,
image: token.picture,
name: token.name
}
}
return Promise.resolve(session)
},
},
callbacks: {
jwt: async ({ token, user }) => {
if (user) {
token.user = user;
}
return Promise.resolve(token);
},
session({ session, token }) {
if(token.user){
session.user = {
id: token.sub || "",
handle: token.user.handle, <-- here
email: token.email,
image: token.picture,
name: token.name
}
}
return Promise.resolve(session)
},
},
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server