New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(providers): profile types #4202
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nextauthjs/next-auth/FyyGsKMSx6juN6X7qRw8qeR3EfcC [Deployment for 43bd01a canceled] |
@@ -15,10 +15,11 @@ export interface WorkOSProfile { | |||
email: string | |||
lastName: string | |||
firstName: string | |||
picture: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm adding this field as it was read optimistically in the below profile()
function.
Now that the types work TS was complaining that it wasn't declared in the interface
. I believe the contributor just forgot to do so 💭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I think this would solve #3350 too. I wasn't sure how to solve that issue back then. Nice work! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah great catch!
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Reasoning 💡
When reviewing this PR #4170 we noticed that the types in our provider files were incorrect.
When declaring the options for the provider profile, we were doing this:
but TS is not able to infer the types correctly as you can see:
However changing it like this:
enables TS to pick up the types correctly:
I believe both syntaxes are more or less equivalent to what we want to achieve which is typing the profile object of the provider but allowing extra fields for user flexibility.
Checklist 🧢
DocumentationTestsAffected issues 🎟
None