nextjs - ✅(Solved) Fix duplicate type in tsconfig for ".next/dev/types/**/*.ts" [3 pull requests, 6 comments, 6 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#85028Fetched 2026-04-08 02:17:42
View on GitHub
Comments
6
Participants
6
Timeline
22
Reactions
8
Author
Timeline (top)
commented ×6subscribed ×6cross-referenced ×3labeled ×3

Fix Action

Fixed

PR fix notes

PR #85053: fix(tsconfig.json): prevent duplicate tsconfig include entries on Windows

Description (problem / solution / changelog)

Fixes an issue where running npm run dev on Windows would add duplicate entries to tsconfig.json's include array - one with backslashes (.next\dev/types/**/*.ts) and one with forward slashes (.next/dev/types/**/*.ts).

The fix normalizes all paths to POSIX-style (forward slashes) using path.posix and deduplicates the nextAppTypes array using a Set before adding entries to tsconfig.json.

This solution is cross-platform compatible and works consistently on Windows, macOS, and Linux.

For Contributors

Fixing a bug

  • Related issues linked using fixes #number
  • Tests added - existing test suite (writeConfigurationDefaults.test.ts) covers this functionality and passes
  • Errors have a helpful link attached (N/A - no new errors introduced)

What?

This PR fixes a Windows-specific bug where duplicate TypeScript config entries were added to tsconfig.json's include array during npm run dev.

Why?

On Windows, the distDir path separator handling caused the same logical path to appear twice in different formats:

  • .next\dev/types/**/*.ts (mixed separators from Windows path operations)
  • .next/dev/types/**/*.ts (POSIX-style from string templates)

This resulted in duplicate console log messages and duplicate entries in the tsconfig, confusing users.

Changes:

  • Modified packages/next/src/lib/typescript/writeConfigurationDefaults.ts
  • No breaking changes
  • No new dependencies
  • Existing tests pass

Before: Duplicate lines added to tsconfig.json

Console message:

We detected TypeScript in your project and reconfigured your tsconfig.json file for you.
The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's needs:

        - include was updated to add '.next\dev/types/**/*.ts'
        - include was updated to add '.next\dev/types/**/*.ts'
<img width="481" height="292" alt="Screenshot 2025-10-18 143141" src="https://github.com/user-attachments/assets/dca84f17-eb65-441c-80d4-e01b1feb2cbb" />

After: tsconfig.json contains single deduplicated path

<img width="470" height="235" alt="Screenshot 2025-10-18 192923" src="https://github.com/user-attachments/assets/98eb07c3-1c4e-465d-8c58-47b2c9dafae2" />

How?

The fix adds path normalization and deduplication in writeConfigurationDefaults.ts:

  1. Path Normalization: Added toPosix() helper that converts all paths to POSIX-style (forward slashes) using path.posix.sep
  2. Deduplication: Use Set to remove duplicate entries before adding to tsconfig
  3. Cross-platform: Works on Windows, macOS, and Linux since TypeScript accepts POSIX paths on all platforms

Closes NEXT- Fixes #85028

-->

Changed files

  • packages/next/src/lib/typescript/writeConfigurationDefaults.ts (modified, +17/-7)

PR #85056: fix(tsconfig.json): prevent duplicate tsconfig include entries on Windows

Description (problem / solution / changelog)

Fixes an issue where running npm run dev on Windows would add duplicate entries to tsconfig.json's include array - one with backslashes (.next\dev/types/**/*.ts) and one with forward slashes (.next/dev/types/**/*.ts).

The fix normalizes all paths to POSIX-style (forward slashes) using path.posix and deduplicates the nextAppTypes array using a Set before adding entries to tsconfig.json.

This solution is cross-platform compatible and works consistently on Windows, macOS, and Linux.

For Contributors

Fixing a bug

  • Related issues linked using fixes #number
  • Tests added - existing test suite (writeConfigurationDefaults.test.ts) covers this functionality and passes
  • Errors have a helpful link attached (N/A - no new errors introduced)

What?

This PR fixes a Windows-specific bug where duplicate TypeScript config entries were added to tsconfig.json's include array during npm run dev.

Why?

On Windows, the distDir path separator handling caused the same logical path to appear twice in different formats:

  • .next\dev/types/**/*.ts (mixed separators from Windows path operations)
  • .next/dev/types/**/*.ts (POSIX-style from string templates)

This resulted in duplicate console log messages and duplicate entries in the tsconfig, confusing users.

Changes:

  • Modified packages/next/src/lib/typescript/writeConfigurationDefaults.ts
  • No breaking changes
  • No new dependencies
  • Existing tests pass

Before: Duplicate lines added to tsconfig.json

Console message:

We detected TypeScript in your project and reconfigured your tsconfig.json file for you.
The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's needs:

        - include was updated to add '.next\dev/types/**/*.ts'
        - include was updated to add '.next\dev/types/**/*.ts'
<img width="481" height="292" alt="Screenshot 2025-10-18 143141" src="https://github.com/user-attachments/assets/dca84f17-eb65-441c-80d4-e01b1feb2cbb" />

After: tsconfig.json contains single deduplicated path

<img width="470" height="235" alt="Screenshot 2025-10-18 192923" src="https://github.com/user-attachments/assets/98eb07c3-1c4e-465d-8c58-47b2c9dafae2" />

How?

The fix adds path normalization and deduplication in writeConfigurationDefaults.ts:

  1. Path Normalization: Added toPosix() helper that converts all paths to POSIX-style (forward slashes) using path.posix.sep
  2. Deduplication: Use Set to remove duplicate entries before adding to tsconfig
  3. Cross-platform: Works on Windows, macOS, and Linux since TypeScript accepts POSIX paths on all platforms

Closes NEXT- Fixes #85028

-->

Changed files

  • packages/next/src/lib/typescript/writeConfigurationDefaults.ts (modified, +17/-7)

PR #85400: Fix duplicate .next/types include on Windows

Description (problem / solution / changelog)

Closes https://github.com/vercel/next.js/pull/85056 Closes https://github.com/vercel/next.js/issues/85028 Closes https://linear.app/vercel/issue/NEXT-4754

test plan

  • pnpm create next-app && pnpm dev does not alter the initial tsconfig.json

Changed files

  • packages/next/src/lib/typescript/writeConfigurationDefaults.ts (modified, +8/-3)

Code Example

We detected TypeScript in your project and reconfigured your tsconfig.json file for you.
The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's needs:

        - include was updated to add '.next\dev/types/**/*.ts'
        - include was updated to add '.next\dev/types/**/*.ts'

---

{
  ...
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx",
    ".next/types/**/*.ts",
    ".next/dev/types/**/*.ts",
    "**/*.mts",
    ".next\\dev/types/**/*.ts",
    ".next\\dev/types/**/*.ts"
  ],
  ...
}

---

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 12244
  Available CPU cores: 8
Binaries:
  Node: 22.20.0
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.18.2
Relevant Packages:
  next: 16.0.0-canary.12 // Latest available version is detected (16.0.0-canary.12).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/bennajah/nextjs-app-16-canary-12

To Reproduce

  1. create next app (npx create-next-app@canary)
  2. start dev server (npm run dev)
  3. check tsconfig.json file and console warning

Current vs. Expected behavior

Warning appears in console when running next dev

We detected TypeScript in your project and reconfigured your tsconfig.json file for you.
The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's needs:

        - include was updated to add '.next\dev/types/**/*.ts'
        - include was updated to add '.next\dev/types/**/*.ts'

Duplicate lines added to tsconfig.json

{
  ...
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx",
    ".next/types/**/*.ts",
    ".next/dev/types/**/*.ts",
    "**/*.mts",
    ".next\\dev/types/**/*.ts",
    ".next\\dev/types/**/*.ts"
  ],
  ...
}

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 12244
  Available CPU cores: 8
Binaries:
  Node: 22.20.0
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.18.2
Relevant Packages:
  next: 16.0.0-canary.12 // Latest available version is detected (16.0.0-canary.12).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

TypeScript

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

extent analysis

TL;DR

Remove duplicate include paths from tsconfig.json to resolve the console warning.

Guidance

  • Verify the tsconfig.json file for duplicate include paths, specifically focusing on .next\dev/types/**/*.ts and .next/dev/types/**/*.ts.
  • Remove the duplicate paths to prevent the warning, ensuring that each path is unique.
  • Check the Next.js documentation for any specific recommendations on configuring tsconfig.json for TypeScript projects.
  • Consider running next dev again after modifying tsconfig.json to confirm the warning is resolved.

Example

No code snippet is provided as the issue is related to configuration rather than code.

Notes

This solution assumes that the duplicate paths are the cause of the warning and that removing them will not negatively impact the project's build or development process.

Recommendation

Apply workaround: Remove duplicate include paths from tsconfig.json, as this directly addresses the reported issue without requiring any version upgrades or significant changes to the project setup.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix duplicate type in tsconfig for ".next/dev/types/**/*.ts" [3 pull requests, 6 comments, 6 participants]