Failed to compile.
src/app/api/posts/[slug]/route.ts
Type error: Route "src/app/api/posts/[slug]/route.ts" has an invalid "GET" export:
Type "{ params: { slug: string; }; }" is not a valid type for the function's second argument.
Next.js build worker exited with code: 1 and signal: null
Error: Command "pnpm next build" exited with 1
export const runtime = 'nodejs'
import { getPostBySlug } from '@/lib/api'
import { NextResponse, type NextRequest } from 'next/server'
export async function GET(
request: NextRequest,
context: { params: { slug: string } }
) {
const { slug } = context.params
const post = getPostBySlug(slug)
if (!post) {
return NextResponse.json({ error: 'Not found' }, { status: 404 })
}
return NextResponse.json(post)
}
How do I fix this error when deploying to vercel?