has an invalid "GET" export: Type "{ params: { slug: string; }; }" is not a valid type for the fun
Answered
American black bear posted this in #help-forum
American black bearOP
During the production build process (
This error indicates a fundamental mismatch between the function signature of the exported
next build
), the TypeScript compiler consistently raises a type error in the file located at app/api/blog/[slug]/route.ts
. The error message is as follows:Type error: Route "app/api/blog/[slug]/route.ts" has an invalid "GET" export:
Type "{ params: { slug: string; }; }" is not a valid type for the function's second argument.
This error indicates a fundamental mismatch between the function signature of the exported
GET
handler and the type definition expected by the Next.js framework for dynamic API routes.1 Reply
Asian black bear
Make it
{ params: Promise<{ slug: string; }>; }
Answer