Skip to content

fix: stop versioning next-env.d.ts and generate it for type-check#18238

Closed
pettinarip wants to merge 1 commit into
devfrom
fix/next-env-stable
Closed

fix: stop versioning next-env.d.ts and generate it for type-check#18238
pettinarip wants to merge 1 commit into
devfrom
fix/next-env-stable

Conversation

@pettinarip
Copy link
Copy Markdown
Member

@pettinarip pettinarip commented May 20, 2026

Summary

next-env.d.ts has been showing up as a modified file on every next dev / next build since PR #18139 started tracking it. Two compounding causes:

  1. Prettier round-trip: when ci: consolidate workflows into ci.yml #18139 committed the file, lint-staged ran Prettier on it. Our .prettierrc has semi: false, so the trailing semicolon Next.js writes on the import "./.next/types/routes.d.ts"; line got stripped. Next then sees a mismatch and rewrites it.
  2. Dev vs build path divergence (Next 16): next dev uses .next/dev as distDir, next build uses .next. So the two modes write different paths (./.next/dev/types/routes.d.ts; vs ./.next/types/routes.d.ts;). No single committed content can satisfy both. This is tracked upstream in vercel/next.js#85738.

The official Next.js guidance is clear:

We recommend adding next-env.d.ts to your .gitignore file.
Running next dev, next build, or next typegen regenerates this file.

This PR follows that guidance:

  • Re-adds next-env.d.ts to .gitignore (reverts the line removal in ci: consolidate workflows into ci.yml #18139).
  • Untracks the file.
  • Changes pnpm type-check from tsc --noEmit to next typegen && tsc --noEmit. next typegen ships in Next 15.5+ and generates next-env.d.ts + .next/types/{routes,validator,cache-life}.d.ts in ~600ms — no full build needed, and as a bonus the CI type-check now actually validates the typed-routes layer (it didn't before, because .next/types/ didn't exist in CI).

Test plan

  • git status stays clean across pnpm dev and pnpm build locally
  • CI type-check job passes
  • First-time clone (no .next/) → pnpm type-check works end-to-end

References

@pettinarip pettinarip requested a review from wackerow as a code owner May 20, 2026 15:19
@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 3fd2ca0
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/6a0dd11b3dd7f90009a6af1a
😎 Deploy Preview https://deploy-preview-18238.ethereum.it
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 67 (🟢 up 3 from production)
Accessibility: 96 (no change from production)
Best Practices: 100 (🟢 up 1 from production)
SEO: 98 (🔴 down 1 from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the config ⚙️ Changes to configuration files label May 20, 2026
@pettinarip pettinarip closed this May 20, 2026
@github-actions github-actions Bot added the abandoned This has been abandoned or will not be implemented label May 20, 2026
@pettinarip pettinarip changed the title fix: stop next-env.d.ts churn on every dev/build fix: stop versioning next-env.d.ts and generate it for type-check May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

abandoned This has been abandoned or will not be implemented config ⚙️ Changes to configuration files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant