Skip to content
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

Delete default type for generic param in CredentialsConfig #2763

Closed
wants to merge 1 commit into from

Conversation

kjugi
Copy link

@kjugi kjugi commented Sep 15, 2021

Reasoning 💡

By setting the default type for generic like {} we are blocking the inference of type in credentials as the whole typing is intended to do (I think so).

After that change we are able to do the following code in TS with strict mode enabled:

import CredentialsProvider from 'next-auth/providers/credentials';

CredentialsProvider({
  credentials: {
    email: {
      label: 'email',
      type: 'text',
    },
    password: {
      label: 'password',
      type: 'password',
    },
  },
  async authorize() {
    try {
      await fetch('/testing');

      return {
        id: '',
      }
    } catch (err) {
      return null;
    }
  },
}),

I'm aware that marking it as any is never the best solution as I'm doing in the Provider type. But it can get any object shape from us in that case I guess.

Checklist 🧢

  • Documentation
  • Tests
  • Ready to be merged

Affected issues 🎟

Don't know if resolves the following issues so they are just marked as affected.

#2701
#2677

@balazsorban44
Copy link
Member

I believe this has been fixed in #2802 by @Thisen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Refers to `@auth/core` providers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants