Skip to content
Sandeep Kumar
Updated 3 min read

Next.js 16 in practice: the changes that actually bit me

Next.js 16 upgrade notes: async params everywhere, typed PageProps, middleware renamed to proxy, a Tailwind 4 gotcha, and the docs inside node_modules.

Sandeep Kumar, Full-stack EngineerSandeep KumarFull-stack Engineer
On this page
  1. params is a Promise
  2. Use the generated PageProps and LayoutProps
  3. middleware.ts is now proxy.ts
  4. The docs ship inside the package
  5. Static by default, deliberately
  6. Tailwind 4 will not @apply your own classes
  7. Where it leaves me

I have moved several side projects, this site included, to Next.js 16 with React 19 and Tailwind CSS 4. Most of the upgrade was uneventful. These are the parts that cost me time.

params is a Promise

In pages, layouts, route handlers and generateMetadata, both params and searchParams are Promises now. Forget the await and you get a confusing runtime error rather than a type error, assuming you typed the props loosely enough to get that far.

tsx
export default async function Page({ params }: PageProps<"/blog/[slug]">) {
  const { slug } = await params;
  // ...
}

Use the generated PageProps and LayoutProps

Next generates route-aware types during next dev, next build or next typegen. PageProps<"/blog/[slug]"> gives you strict keys for params with no hand-written interface, and a typo in the route literal becomes a compile error instead of an undefined at runtime. LayoutProps<"/"> does the same for layouts.

Worth knowing if you run tsc --noEmit in CI before anything else: these globals do not exist until one of those three commands has run at least once, so a clean checkout fails typecheck with Cannot find name 'PageProps' and nothing is actually wrong. Run next typegen first.

middleware.ts is now proxy.ts

The middleware file convention is deprecated and renamed to proxy. Same idea, which is running code before a request is rendered for redirects, rewrites and headers, but the name now describes what it is for rather than where it sits.

Do not build auth that depends on shared modules or globals in there. It may run separately from your render code, and that separation is the whole point of the rename.

The docs ship inside the package

node_modules/next/dist/docs/ contains the documentation for the exact version you installed.

This turned out to be the most useful thing I learned about Next 16, because when a blog post and an AI suggestion disagree about an API, that folder settles it in about four seconds. I grep it before touching anything I have not used in this version, and it has corrected me more than once.

It is also where I found the images.qualities change, which I had described wrongly in the LCP post until I checked it there.

Static by default, deliberately

This blog has no database. Posts are Markdown files read at build time.

ts
export const dynamicParams = false;

export function generateStaticParams() {
  return getAllPosts().map((p) => ({ slug: p.slug }));
}

With dynamicParams = false, any slug not generated at build time is a clean 404 rather than an accidental server render of a junk URL. The RSS feed is a route handler marked force-static.

Tailwind 4 will not @apply your own classes

In Tailwind 4 you cannot @apply a plain CSS class you defined yourself. Declare it with @utility and it composes like any built-in:

css
@utility btn { @apply inline-flex items-center rounded-full px-5 py-2.5; }
@utility btn-primary { @apply btn bg-fg text-bg; }

This one cost me an hour of staring at a stylesheet that looked correct.

Where it leaves me

Next 16 rewards being explicit. Typed routes, static generation you have to opt out of rather than into, file names that describe behaviour.

The upgrade is mostly mechanical if you read the bundled docs first, and mostly frustrating if you read blog posts first, mine included. That folder in node_modules is the single best habit I picked up from this release.

If the upgrade is also an excuse to look at speed, the levers that matter are in Next.js performance.

Frequently asked

Do I have to await params in Next.js 16?

Yes. In pages, layouts, route handlers and generateMetadata, both params and searchParams are Promises. If your props are typed loosely the mistake survives compilation and surfaces as a confusing runtime error, so the generated PageProps type is worth using for exactly this reason.

Why does tsc fail with "Cannot find name PageProps" in CI?

Because those route-aware globals are generated, not shipped. They appear after next dev, next build or next typegen has run at least once, so a pipeline that runs typecheck first on a clean checkout fails with nothing actually wrong. Run next typegen before tsc.

What replaced middleware.ts in Next.js 16?

proxy.ts. The filename and the named export are both deprecated, so rename the file and the exported function. The proxy runtime is nodejs and cannot be configured; if you need the edge runtime you have to stay on middleware for now.

Why can I no longer @apply my own CSS class in Tailwind 4?

Tailwind 4 only lets @apply compose utilities, not arbitrary classes you defined yourself. Declare the class with @utility instead and it composes like any built-in, including inside other @utility definitions.

Found this useful?Share on XShare on LinkedIn

Related reading