Closed blomqma closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
next-rest-framework | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Oct 23, 2023 9:32pm |
next-rest-framework-demo | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Oct 23, 2023 9:32pm |
Previously, the problem with App Router was that truly strongly-typed responses were not possible due to the
NextResponse
class not supporting a generic typing of the status codes. This change adds a patchedTypedNextResponse
class that adds support for type-checking the response status codes based on the output schema.In order to achieve this, the user must import the
TypedNextResponse
class from Next REST Framework, but the good thing is that this is fully optional and using the plainNextResponse
is still supported if the user prefers not to have strongly typed status code checks.