Exclude metadata files from route handler type validation (#99377)
## Summary Metadata files such as `app/icon.tsx` export a default handler, rather than HTTP methods. Validating them as ordinary route handlers rejects the documented `size` and `contentType` exports with TS2559 during `next typegen` + `tsc`. Exclude metadata files from ordinary route-handler validation in both validator modes by matching the `route.<extension>` file convention, including custom page extensions. Add an icon fixture with the documented exports and a regression test that checks generated validation, retains an ordinary route-handler control, and runs `tsc`. Correct the existing non-strict invalid-page-props assertion as well. The same failure reproduces on the unchanged base commit: non-strict `AppPageConfig` accepts arbitrary props, so the per-page check emits the invalid-props diagnostic instead. The test still requires a failed build and the specific invalid-props error; strict mode retains its `AppPageConfig` assertion. ## Verification - Reproduced the stale assertion on unchanged base commit `3932a6bd`: 12/13 tests passed, with only invalid-page-props failing. - Full Webpack validator suite: **14/14 passed** in normal mode and **14/14 passed** with `__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES=true`. Both runs include the icon regression and invalid ordinary-handler checks. - Core Next.js build (including types), formatting, and ESLint passed. - Direct before/after checks verified that both generators exclude metadata files while retaining ordinary and custom-extension route handlers. - Tests use `NEXT_SKIP_ISOLATE=1` because the isolated install cannot resolve the configured package registry. Full bootstrap in the temporary worktree hit environment restrictions; the core package build passed. <!-- NEXT_JS_LLM -->
Showing
Please
register
or
sign in
to comment