Skip to content

Next.js 15 params Type Error During Build – Promise<any> Expected? New to programming - advice #80494

Answered by xabierlameiro
attilayc asked this question in Help

You must be logged in to vote

This is a confirmed change in Next.js 15 where params are now asynchronous. The solution is to update your page components to await the params:

interface PageProps {
  params: Promise<{ slug: string }>
}

export default async function Page({ params }: PageProps) {
  const { slug } = await params;
  // rest of your component logic
}

Why this happened:
Next.js 15 introduced async params to enable better streaming and performance optimizations. This affects all dynamic route segments.

Quick fixes:

  1. Recommended: Update to async pattern above
  2. Alternative: Use the use() hook for client components:
import { use } from react;

function ClientComponent({ params }: { params: Promise<{ slug: string }>

Replies: 2 comments 2 replies

You must be logged in to vote
2 replies
@attilayc

@icyJoseph

You must be logged in to vote
0 replies
Answer selected by attilayc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants