DEV Community

loading...

Discussion on: How to handle Next.js Api routes more type safely

Collapse
ryohlan profile image
Ryohlan Author

Next.js NextApiHandler can define only one response body type.
So if a route has multiple methods and response body types, you will use the Type Assertion and you will need to write many codes more.
This utility method can decrease codes a little.