Summary
Next.js added generated type definitions for next/root-params, which provides runtime getter functions for root layout parameters. The module already existed at runtime but now has build-time type generation that produces a root-params.d.ts file under .next/types.
Upstream
What changed
next/root-params exports async getter functions (e.g., lang(), locale()) for each root param discovered from App Router root layouts
- Type generation:
.next/types/root-params.d.ts is produced during next build, next dev, and next typegen
- Root params are collected from layout routes in the route types manifest by scanning for the shallowest layout in each branch (root layouts)
- Params can be
string, string[], or undefined depending on whether they're optional, catch-all, or missing from some roots
- Feature is enabled when
experimental.rootParams or cacheComponents is true
- The generated types are wired into
next-env.d.ts via an ESM import
Impact on vinext
vinext needs to:
- Add
next/root-params to the shim map in resolveId so imports resolve correctly
- Implement the runtime module — since vinext scans
app/ directories for routing, it can detect root layout params and generate the appropriate getter functions
- Consider type generation if vinext supports TypeScript project references or
next-env.d.ts equivalent
This is primarily relevant for App Router apps that use root-level dynamic segments (e.g., app/[lang]/layout.tsx). The runtime behavior is the higher priority; type generation can follow later.
Summary
Next.js added generated type definitions for
next/root-params, which provides runtime getter functions for root layout parameters. The module already existed at runtime but now has build-time type generation that produces aroot-params.d.tsfile under.next/types.Upstream
What changed
next/root-paramsexports async getter functions (e.g.,lang(),locale()) for each root param discovered from App Router root layouts.next/types/root-params.d.tsis produced duringnext build,next dev, andnext typegenstring,string[], orundefineddepending on whether they're optional, catch-all, or missing from some rootsexperimental.rootParamsorcacheComponentsis truenext-env.d.tsvia an ESM importImpact on vinext
vinext needs to:
next/root-paramsto the shim map inresolveIdso imports resolve correctlyapp/directories for routing, it can detect root layout params and generate the appropriate getter functionsnext-env.d.tsequivalentThis is primarily relevant for App Router apps that use root-level dynamic segments (e.g.,
app/[lang]/layout.tsx). The runtime behavior is the higher priority; type generation can follow later.