I am going through the Next JS course and learning Routing and Navigation. While learning"unexpected errors" when I have to build my solution it shows below error and I am not able to find a solution for it.
[email protected] build
next build
▲ Next.js 15.0.2
Creating an optimized production build …
✓ Compiled successfully
Linting and checking validity of types Failed to compile.
16:19:36.042
16:19:36.043
app/(root)/events/[id]/page.tsx
16:19:36.043
Type error: Type ‘SearchParamProps’ does not satisfy the constraint ‘PageProps’.
16:19:36.043
Types of property ‘params’ are incompatible.
16:19:36.043
Type ‘{ id: string; } | Promise<{ id: string; }>’ is not assignable to type ‘Promise | undefined’.
16:19:36.043
Type ‘{ id: string; }’ is missing the following properties from type ‘Promise’: then, catch, finally, [Symbol.toStringTag]
16:19:36.044
16:19:36.127
Error: Command “npm run build” exited with 1
16:19:36.356
CODE IS AS BELOW
const EventDetails = async ({
params,
searchParams,
}: SearchParamProps) => {
const { id } = await Promise.resolve(params);
const event = await getEventById(id);
const relatedEvents = await getRelatedEventsByCategory({
categoryId: event.category._id,
eventId: event._id,
page: searchParams?.page as string,
});