mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What? Fixes #51130. Before this PR, the package assumes that route handlers return a `Response` which is not necessarily the case. The linked issue specified three suggestions to resolve this 1. Return a default 200 response 2. Throw a better error message 3. or both ~~In this issue I implemented (3), except that it is a warning and not an error. Do tell if the team wants to follow a different approach, as it is not too hard to change this.~~ This PR implements (2). ### How? The returned value of the handler is checked at runtime to ensure it is actually a `Response` instance. The return type `AppRouteHandlerFn` is also modified to `unknown` to avoid similar assumptions elsewhere. The TS plugin is also modified to check for the return type during build time. Co-authored-by: JJ Kasper <[email protected]>
2 lines
26 B
TypeScript
2 lines
26 B
TypeScript
export function POST() {}
|