analog-org / analog-tsx

Discord Bot template for building Discord bots with a dashboard. Uses NextJS, Discord.JS, Typescript, TurboRepo, TailwindCSS, and Prisma
https://analog.bossdaily.me/
GNU General Public License v3.0
7 stars 2 forks source link

Improve typescript implemntation of the implemented AuthOptions. #3

Open nikolaischunk opened 11 months ago

nikolaischunk commented 11 months ago

Topic

The whole repository serves as a great starting point for creating a dashboard in combination with a bot. Since this repo serves as a template, it would awesome if the implementation of the auth would be correctly typesafed.

This File

NextAuth provides a way to augment the different interfaced, that are used, like Session.

https://next-auth.js.org/getting-started/typescript#module-augmentation

Own Implementation

I used this to augment the session user field, but am stuck, when it comes to the profile, jwt etc types

https://github.com/BirthdayyBot/dashboard/blob/develop/src/lib/types/next-auth.d.ts https://github.com/BirthdayyBot/dashboard/blob/develop/src/lib/options/auth.ts

If this is successful, it would be something that never has been documented (afaik), so pretty useful.

Related Links

https://github.com/nextauthjs/next-auth/discussions/3774 https://github.com/analog-org/analog-tsx/blob/master/apps/dashboard/src/pages/api/auth/%5B...nextauth%5D.ts https://authjs.dev/getting-started/typescript https://next-auth.js.org/configuration/callbacks#session-callback https://github.com/nextauthjs/next-auth/issues/614

BossDaily commented 10 months ago

Sorry for taking forever, I was in Kenya when you submitted this. I am also facing this dilemma with the profile types