Next.js Discord

Discord Forum

'ParamCheck<RouteContext>

Answered
Japanese anchovy posted this in #help-forum
Open in Discord
Avatar
Japanese anchovyOP
I'm trying to run npm build and I keep getting this type error

Type error: Type '{ tag: "GET"; param_position: "second"; param_type: RouteParams; }' does not satisfy the constraint 'ParamCheck<RouteContext>'.
The types of 'param_type.params' are incompatible between these types.
Type '{ id: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]

code below ---
type RouteParams = { params: { id: string } };

export async function GET(_request: NextRequest, { params }: RouteParams) {
const notebook = await prisma.notebook.findUnique({
where: { id: params.id },
});

I keep getting the same error no matter how I wrote my code.
Answered by B33fb0n3
can you name the request request and inline the types?

After that it should look like this:
export async function GET(
  request: NextRequest,
  { params }: { params: Promise<{ slug: string }> }
) {
  const slug = ...
}

Ignore the promise params when you are not using next15
View full answer

3 Replies

Avatar
can you name the request request and inline the types?

After that it should look like this:
export async function GET(
  request: NextRequest,
  { params }: { params: Promise<{ slug: string }> }
) {
  const slug = ...
}

Ignore the promise params when you are not using next15
Answer
Avatar
Japanese anchovyOP
Thank you. Problem solve.
Avatar
happy to help