nextjs 15 params
Answered
Sun bear posted this in #help-forum
Sun bearOP
i am using "next": "15.0.2", and the correct syntax for params i think is:
and it works locally but when i deploy on vercel i keep getting this error:
Failed to compile.
app/[country]/forums/page.tsx
Type error: Type '{ params: { country: string; }; }' does not satisfy the constraint 'PageProps'.
Types of property 'params' are incompatible.
Type '{ country: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]
Error: Command "npm run build" exited with 1
-> please help if you can, thank you
// app/[country]/page.tsx
import { redirect } from 'next/navigation';
export default async function Page({
params,
}: {
params: Promise<{ country: string }>;
}) {
const { country } = await params;
redirect(`/${country}/scores`);
return null;
}
and it works locally but when i deploy on vercel i keep getting this error:
Failed to compile.
app/[country]/forums/page.tsx
Type error: Type '{ params: { country: string; }; }' does not satisfy the constraint 'PageProps'.
Types of property 'params' are incompatible.
Type '{ country: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]
Error: Command "npm run build" exited with 1
-> please help if you can, thank you
Answered by joulev
the bug is in app/[country]/forums/page.tsx not app/[country]/page.tsx. your app/[country]/page.tsx (code provided) is correct
2 Replies
the bug is in app/[country]/forums/page.tsx not app/[country]/page.tsx. your app/[country]/page.tsx (code provided) is correct
Answer
Sun bearOP
@joulev , thank you so much, that fixed it.