next-auth
next-auth copied to clipboard
fix(ts): update `AppRouteHandlerFn` type to handle `null` response from middleware handler
☕️ Reasoning
In NextAuth Function in Middleware type null does not contain in overload
Before code updation 👇
Type Error: No overload matches this call.
Allow Null Return Value: The AppRouteHandlerFnContext type now includes null as a valid return value. This addresses the error: No overload matches this call : " Type 'null' is not assignable to type 'void | Response | Promise<void | Response>'"
After code updation 👇
🧢 Checklist
- [ ] Documentation
- [x] Tests
- [x] Ready to be merged
🎫 Affected issues
Fixed: #10047
📌 Resources
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
auth-docs | ❌ Failed (Inspect) | Feb 17, 2024 0:10am |
1 Ignored Deployment
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
next-auth-docs | ⬜️ Ignored (Inspect) | Visit Preview | Feb 17, 2024 0:10am |
@ajstars1 is attempting to deploy a commit to the authjs Team on Vercel.
A member of the Team first needs to authorize it.
Hmm interesting.
@balazsorban44 it looks like Next.js itself just types this as unknown
actually. Should we switch to that? Save ourselves some potential future trouble?
See: https://github.com/vercel/next.js/blob/canary/packages/next/src/server/future/route-modules/app-route/module.ts#L81-L91
PR which updated it last with some comments about why, etc.: https://github.com/vercel/next.js/commit/f47c40917485bac359df0e3c57d5394a7bcb1e90#diff-66b976b1650819b48a11d6d16d984057aa95192edcd52e936fbeec386fc9c8eb
still under review?