v5 - Differences between signIn
function return types between v4 and v5
#11955
Unanswered
AustinKostreba
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've noticed that the returned types for the
signIn
function are different between v4 and v5. In v4, we would import sign in like this:import { signIn} from next-auth/react
. However, in v5, we import it from the exportedsignIn
function in the auth.ts file.Here is the v4 function type definition to show the types:
And here is the v5 function type definition:
My app supports multiple credentials providers to handle various login methods, like credentials logins and LDAP logins. In v4, deriving these types was easy. I'm not directly redirecting on a successful sign in, so it was useful to get a detailed response from the sign in, and the types would be correctly inferred by setting the first parameter to the id set for that credentials provider. For example,
However, in v5, the response resolves to either any or never, and the SignIn function only recognizes the default credentials provider, and can't correctly infer any of the types for the provider I've exampled (or any other ones, for that matter).
Am I missing something, or does this not seem like a direct regression for this function? It used to be so good at automatically handling any provider I threw at it, but now I feel like all the benefits of typescript are totally absent here.
Beta Was this translation helpful? Give feedback.
All reactions