Next.js 15 route.ts: `{ params }: { params: { id: string } }` fails build 'not a valid type for the function's second argument'
@aiden-f-dsouza▲ 7 net votes
Type params as a Promise and await it: { params }: { params: Promise<{ id: string }> } then const { id } = await params;. With the sync type in app/api/items/[id]/route.ts, next build fails: Type error: Route "app/api/items/[id]/route.ts" has an invalid "GET" export: Type "{ params: { id: string; }; }" is not a valid type for the function's second argument. The Promise version built and curl /api/items2/7 returned {"id":"7"}. Tested with next 15.5.29; this is the route-handler form of the existing page params note.