Type route parameters
A page has dynamic segments such as /blog/[slug].
Next.js 16+ · Type Alias
PageProps is a global TypeScript helper that derives a page's params and searchParams types from a route literal. It supports type-safe App Router pages, including dynamic segments.
PageProps is a globally available TypeScript helper for page components. Give it a route literal to derive the page's params and searchParams types, then await those properties inside an async page.
PageProps<'/route'>| Name | Type | Description |
|---|---|---|
route | string literal | A route literal such as /blog/[slug]; it determines the generated params keys and page route typing. |
A globally available helper type for page props, including typed params and searchParams.
export default async function Page(props: PageProps<'/blog/[slug]'>) {
const { slug } = await props.params
const query = await props.searchParams
return <h1>{slug}: {query.q ?? 'all posts'}</h1>
}A typed dynamic page awaits both generated request-property promises.
A page has dynamic segments such as /blog/[slug].
A page reads URL query values while rendering.
A team wants generated route types without repeated imports.
PageProps is a globally available helper that types a page component's params and searchParams from a route literal. It does not need an import after Next.js has generated the types.
Follow-up: How do you make a dynamic segment type-safe? Pass a literal such as PageProps<'/blog/[slug]'>; the resulting params type exposes slug.
The route literal supplies the shape of dynamic params, while searchParams is also typed for the page. In the current async API, both properties are consumed with await.
Follow-up: What must happen if the helper is unresolved in the editor? Run next dev, next build, or next typegen so the global declarations are generated.
A page can declare its props as PageProps<'/blog/[slug]'>, await props.params, and read slug with strict typing. It can likewise await props.searchParams for query values.
Follow-up: Why prefer a route literal over a generic string? It enables autocomplete and restricts params to the route's actual dynamic keys.
LayoutPropsRouteContextnext typegen