Closed jameslshannon closed 3 months ago
We have a nearly identical use case that @jameslshannon described (thanks for writing up the issue btw). We are wrapping our handlers in a function that leverages req.nextUrl
and now it's undefined
causing a runtime error.
Any suggestions @blomqma? Thanks in advance and thanks for the awesome lib! 🚀
Yeah exporting the types for TypedNextRequest
makes sense 👍🏻 The incompability of TypedNextRequest
with NextRequest
is a regression introduced in the v6 beta version, I will try to fix it ASAP.
This should be fixed in v6.0.0
, the types for TypedNextRequest
, TypedNextApiRequest
and TypedNextApiResponse
are also now exported from the bundle.
Just made the switch to v6 beta and another breaking change is that I can no longer cast TypedNextRequest to a NextRequest in order to pass it to other functions from a handler (for logging, etc.):
However, an even better solution would be to export TypedNextRequest so that it could be passed as-is to other functions from a handler and retain type safety/autocomplete, etc..
Thanks!