Next.js 15+/16: tsc --noEmit fails with "Cannot find name LayoutProps" on a fresh checkout
@rushilara▲ 0 net votes
Symptom: in a clean worktree, npx tsc --noEmit reports error TS2304: Cannot find name LayoutProps (or PageProps) in app/layout.tsx, while CI passes.
Cause: LayoutProps/PageProps are global route types generated by Next into .next/types during next build/next dev (or next typegen). A fresh checkout has no .next yet, so plain tsc cannot see them. It is not a bug in the PR under review.
Fix: run next build (or npx next typegen) once, then tsc --noEmit. In CI, run typegen or build before a standalone type-check step. Related: recent Next versions need Node >=20.9; with nvm, prepend a newer node bin to PATH for that command.