Pages

Topics

Tools

↑↓navigate↵openescclose
All guides

Next.js: Page does not match the required types of a Next.js Page

The validator needs Promise params and exact keys. Make pages async, await searchParams, and let PageProps from next typegen replace your own prop types.

~5 min readNext.js
#nextjs#app-router#typescript#page-props
Bold white headline reading PAGE TYPE ERROR with a Next.js page crate rejected at an amber validator gate on the right.

Introduction & Quick Summary

next build stops with a type error that names the file, not a line of your code:

code
Type error: Page "src/app/blog/[slug]/page.tsx" does not match the required types of a Next.js Page. "props" is an invalid Page type.

The message means Next.js validated your default export against the shape it will call at runtime, and your signature disagrees. In the App Router the validator is strict: extra props, optional params, and a synchronous params object in Next.js 15 and later all fail it.

Quick answer for Next.js 15 and 16, where params is a Promise:

tsx
export default async function Page({ params, }: { params: Promise<{ slug: string }>; }) { const { slug } = await params; return <article>{slug}</article>; }

Next.js 16 also ships generated route types. PageProps<"/blog/[slug]"> is available after next typegen (or any next dev/next build run) and keeps the signature in sync with the folder name, which removes the hand-written prop type entirely.

The usual triggers, in order of frequency:

  • A page copied from a Next.js 13 or 14 codebase with params: { slug: string }.
  • props: { params?: ...; searchParams?: ... } with both optional, added to silence an earlier error.
  • A layout.tsx that declares its own children type and forgets params.
  • A stale .next/types directory after renaming a dynamic segment.
  • A page that exports extra named fields the validator does not recognise.

Core Mechanics, Signatures & Reproducible Setup

The App Router generates a type-check file per route during the build. It declares the expected props for that path and asserts that your default export is assignable to it. The check runs before compilation of the pages themselves, which is why the error text talks about the file and not a specific expression.

What each route file receives:

tsx
// app/blog/[slug]/page.tsx type PageProps = { params: Promise<{ slug: string }>; // dynamic segments searchParams: Promise<Record<string, string | string[] | undefined>>; }; // app/blog/[slug]/layout.tsx type LayoutProps = { children: React.ReactNode; params: Promise<{ slug: string }>; }; // app/api/items/[id]/route.ts — route handlers use a context argument export async function GET( request: Request, ctx: { params: Promise<{ id: string }> }, ) { const { id } = await ctx.params; return Response.json({ id }); }

Reproduce the failure without any application code:

bash
npx create-next-app@latest typeerr --ts --app --no-tailwind --no-eslint --no-src-dir cd typeerr mkdir -p app/blog/\[slug\] cat > app/blog/\[slug\]/page.tsx <<'EOF' export default function Page({ params }: { params: { slug: string } }) { return <div>{params.slug}</div>; } EOF npx next build

The build fails on exactly the message above. Change the type to Promise<{ slug: string }>, make the function async, add const { slug } = await params, and the same page compiles.

Two details matter when you fix it by hand. First, params and searchParams are always Promises in Next.js 15+, so a page that never awaits them still needs async if it reads them. Second, children belongs to layouts only; a page that declares children fails the same validator with a different invalid field name.

Key Comparison Table

The signature changed across majors. Copying from the wrong column is the whole bug:

Next.jsparams typeMust awaitNotes
13.4 – 14.x{ slug: string }nosynchronous props
15.0 – 15.4Promise<{ slug: string }>yessync access logs a deprecation warning
15.5+Promise<{ slug: string }>yesPageProps<"/route"> helper available
16.xPromise<{ slug: string }>yessync access throws; typegen is on by default

Which file gets which props:

FileReceivesCommon mistake
page.tsxparams, searchParamsadding children
layout.tsxchildren, paramsomitting children
template.tsxchildrendeclaring params for a non-dynamic route
route.tsrequest plus context with paramstreating the context as props
generateMetadatasame props as the pageleaving it synchronous

Reading the validator output instead of guessing:

Message fragmentReal causeFix
"props" is an invalid Page typeprop object does not matchuse Promise params and exact keys
"default" is an invalid Page typenot a component, or returns voidreturn JSX; export default
Page "..." does not match after a renamestale generated typesdelete .next and rebuild
Type 'Promise<...>' is not assignable to type '{...}'page still awaits nothing but types are newmake it async and await

Practical Edge Cases, Error Fixes & Deep Dive Code Examples

1. The synchronous page from an old tutorial

tsx
// fails on Next.js 15 and later export default function Page({ params }: { params: { slug: string } }) { return <h1>{params.slug}</h1>; } // fixed export default async function Page({ params, }: { params: Promise<{ slug: string }>; }) { const { slug } = await params; return <h1>{slug}</h1>; }

If the page only needs the segment for a metadata call, keep it async anyway; generateMetadata receives the same Promise and both must await.

2. searchParams is a Promise too, and it is per-request

tsx
export default async function Page({ searchParams, }: { searchParams: Promise<{ q?: string; page?: string }>; }) { const { q, page } = await searchParams; const current = Number(page ?? 1); return <Results query={q ?? ""} page={current} />; }

Typing searchParams as Record<string, string> compiles in isolation and fails the validator, because repeated query keys produce string[] and the framework will not narrow that for you.

3. Optional props break the check

Adding ? to quiet a conditional is a common reflex and the validator rejects it, because the framework always passes both objects:

tsx
// rejected { params?: { slug: string } } // correct for a non-dynamic route: omit params entirely export default function About() { return <p>About</p>; }

A static route receives no params key at all, so declaring one — required or optional — is the error.

4. generateMetadata must match the page

tsx
export async function generateMetadata({ params, }: { params: Promise<{ slug: string }>; }): Promise<Metadata> { const { slug } = await params; return { title: slug }; }

A generateMetadata typed with the old synchronous shape produces the same "does not match" text, sometimes attributed to the page because the validator reports per file. Both signatures are checked together.

5. Use the generated types instead of writing them

tsx
// Next.js 15.5+, after next typegen has run once export default async function Page({ params }: PageProps<"/blog/[slug]">) { const { slug } = await params; return <article>{slug}</article>; }

PageProps is global, generated from next-env.d.ts, and updates when the folder is renamed. In CI, run npx next typegen before tsc --noEmit so the type exists on a clean checkout; a workflow that only runs tsc sees Cannot find name 'PageProps'.

6. Stale generated types after moving routes

Renaming [id] to [slug] leaves old declarations in .next/types until the next build regenerates them, and editors then report two conflicting shapes. The reliable reset:

bash
rm -rf .next node_modules/.cache npx next typegen && npx next build

On Vercel the build cache can preserve the same staleness; adding .next to the cache-excluded paths, or bumping a cache-key suffix, clears it once.

Common Compilation/Runtime Mistakes & Version Gotchas

Fixed with as any. Casting the props object hides the error and the page then reads params.slug from a Promise, printing undefined in production. The type error is the only warning you get.

Mixed @types/react copies. A pnpm workspace that hoists two React 19 type packages produces "does not match" errors on pages that are perfectly typed, because the validator compares against its own React types. pnpm why @types/react should show one version.

skipLibCheck: true does not skip this check. The generated file is not a library declaration, and the validation runs regardless of that flag, which is why turning it on never fixed the build.

Next.js 14 to 15 upgrade. Pages keep compiling under 15.0 because synchronous access only logs a deprecation warning, then break on 16 where it throws params should be awaited. Migrate the signatures during the upgrade rather than after.

typedRoutes history. Experimental in 15.0, stable in 15.5, and default in 16. A project that never enabled it has no PageProps helper, only the hand-written Promise types, so a copied snippet fails with Cannot find name 'PageProps'.

Checking the rendered result. After the build passes, confirm the route actually renders with the segment value rather than an empty string; the JSON formatter is handy for comparing a searchParams payload against what the page expects, and status code reference helps distinguish a 404 from a validator failure when testing with curl.

Reference material: page.js file convention and TypeScript configuration in Next.js.

Official references

primary documentation

The Next.js documentation that defines the behaviour this guide explains.

Try matching browser tools

All tools

Small utilities that fit Next.js work — they run entirely in this browser tab, so nothing you paste leaves your device.

All Next.js guides

More in Next.js

All Next.js guides

The guides filed next to this one in Next.js, in library order.