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

RequestInternal not typed #6102

Closed
alex-statsig opened this issue Dec 17, 2022 · 2 comments
Closed

RequestInternal not typed #6102

alex-statsig opened this issue Dec 17, 2022 · 2 comments
Assignees
Labels
question Ask how to do something or how something works TypeScript Issues relating to TypeScript

Comments

@alex-statsig
Copy link

alex-statsig commented Dec 17, 2022

Question 💬

The second argument to "authorize" in a CredentialsProvider is request, of type RequestInternal. I want to access values from the header/method on this for logging purposes. In prior versions this worked fine. After updating to recent versions though, it seems in "credentials.d.ts" CredentialsConfig.authorize has its second argument for RequestInternal imported from '../core'. Looking at that file though (core.d.ts), there is no RequestInternal export. Thus RequestInternal types as any, making my accesses unsafe.

It seems like core/src/index.ts was meant to export it (since credentials imports it), but only imports it

How to reproduce ☕️

const opt: NextAuthOptions = {
  providers: [
    CredentialProvider({
      credentials: {},
      authorize: async (cred, req) => {
        const method: string = req.method; // this triggers lint warnings as method is typed as any, when it should be string
        return null;
      },
    }),
  ],
};

Contributing 🙌🏽

Yes, I am willing to help answer this question in a PR

@alex-statsig alex-statsig added question Ask how to do something or how something works TypeScript Issues relating to TypeScript labels Dec 17, 2022
@balazsorban44
Copy link
Member

Hi, #6132 (comment) could you test out this version to see if it fixes your issue? If it does, it will be included in the next release once the PR is merged!

@balazsorban44
Copy link
Member

4.18.7 is out with this fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Ask how to do something or how something works TypeScript Issues relating to TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants