nextauthjs / next-auth

Authentication for the Web.
https://authjs.dev
ISC License
23.24k stars 3.18k forks source link

Types of NextAuth are not up to date for Route Handlers #8120

Closed yarinsa closed 11 months ago

yarinsa commented 11 months ago

Question 💬

I am migrating my next-auth to the route handlers. It seems like they accept type of "NextApiRequest" but we have "NextRequest" in the route handler. Functionality wise it works perfecet, like the docs declare . It's only a typescript error, I would expect NextAuth to accept request: NextRequest | NextApiRequest since the internal logic does a type check.

I am willing to contribute this change if one of the maintainers here will agree with that change :)

How to reproduce ☕️

Screenshot 2023-07-23 at 13 19 00

Contributing 🙌🏽

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

balazsorban44 commented 11 months ago

Looks like you are correct. awe are missing an overload function here

https://github.com/nextauthjs/next-auth/blob/465644f9e489321bffce6289234957c8e4bd6d2e/packages/next-auth/src/next/index.ts#L110-L115

Can you open a PR against the v4 branch? Thanks!

ThangHuuVu commented 11 months ago

Should be fixed via #8236