next.js
fdf1762c - fix: use ESM import instead of triple-slash reference for routes.d.ts (#82867)

Commit
119 days ago
fix: use ESM import instead of triple-slash reference for routes.d.ts (#82867) ## What? Replace `/// <reference path="./.next/types/routes.d.ts" />` with `import type {} from './.next/types/routes.d.ts'` in generated `next-env.d.ts` files. ## Why? The current implementation uses triple-slash reference directives which trigger ESLint errors when using the `@typescript-eslint/triple-slash-reference` rule. This rule is commonly enabled in TypeScript projects to encourage modern ES module imports over legacy triple-slash references. ## How? - Modified `writeAppTypeDeclarations.ts` to generate ESM import statements instead of triple-slash references - Updated all create-next-app templates to use the new format - Updated corresponding unit tests to reflect the new expected output The change maintains identical TypeScript functionality while improving ESLint compatibility. The `import type {}` syntax ensures type-only imports that are properly elided during compilation. **Testing:** - Existing unit tests pass with updated expectations - Verified ESLint `@typescript-eslint/triple-slash-reference` rule no longer triggers errors - TypeScript functionality remains unchanged Fixes [#82828](https://github.com/vercel/next.js/issues/82828) --------- Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by: Ben Gubler <nebrelbug@gmail.com>
Author
Committer
Parents
Loading