Open
Description
Hi.
If using next build
from 'https://github.com/encoredev/examples/tree/main/nextjs-starter/frontend' - error build
$ next build
▲ Next.js 15.2.3
Creating an optimized production build ...
✓ Compiled successfully
Linting and checking validity of types ...Failed to compile.
app/users/[id]/page.tsx
Type error: Type '{ params: { id: string; }; }' does not satisfy the constraint 'PageProps'.
Types of property 'params' are incompatible.
Type '{ id: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]
Next.js build worker exited with code: 1 and signal: null
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Possible fast fix:
import getRequestClient from "@/app/lib/getRequestClient";
//import { APIError } from "@/app/lib/client";
type Props = {
searchParams: Promise<{ [key: string]: string }>;
};
export default async function UserDetails({
searchParams,
}: Props) {
const client = getRequestClient();
const { id } = await searchParams;
const response = await (await client).user.GetUser(id);
return (
<section>
<h1>Detail for {response.user.name}</h1>
<p>ID: {response.user.id}</p>
</section>
);
}
Using this reference for fix.
Metadata
Metadata
Assignees
Labels
No labels