nextjs - ✅(Solved) Fix @typescript/native-preview does not get detected as typescript [1 pull requests, 5 comments, 4 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#88580Fetched 2026-04-08 02:04:23
View on GitHub
Comments
5
Participants
4
Timeline
23
Reactions
11
Timeline (top)
referenced ×6commented ×5subscribed ×4labeled ×3

Fix Action

Fixed

PR fix notes

PR #89149: feat: detect @typescript/native-preview as alternative TypeScript compiler

Description (problem / solution / changelog)

What?

This PR adds support for detecting @typescript/native-preview as an alternative TypeScript compiler. When installed, Next.js will no longer automatically install the typescript package.

Why?

Fixes #88580

Users who want to use @typescript/native-preview (a Go-based native TypeScript compiler) should not be forced to also install the JavaScript-based typescript package. This is especially relevant for projects using next.config.ts where TypeScript support is provided by Node.js native TS or SWC.

How?

  1. Added hasNativeTypeScriptPreview() function to detect if @typescript/native-preview is installed
  2. Modified the dependency check logic in verifyTypeScriptSetup() to skip auto-installing typescript when the native preview is present
  3. Added an informative log message to notify users that some TypeScript features (like type checking during build) require the standard typescript package
  4. Added e2e test to verify the behavior

Test Plan

  • Added new e2e test at test/e2e/app-dir/typescript-native-preview/
  • The test verifies:
    • Detection message is shown
    • typescript is not auto-installed
    • The app still works (SWC/Turbopack handles compilation)

Changed files

  • packages/next/src/lib/verify-typescript-setup.ts (modified, +70/-7)
  • test/development/typescript-native-preview/index.test.ts (added, +71/-0)

Code Example

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 16.1.1-canary.28 // Latest available version is detected (16.1.1-canary.28).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: N/A
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/jolly-morning-333slj?workspaceId=ws_LsA1CG8MfaugT5vPseu1bf

To Reproduce

  1. Uninstall typescript
  2. Install @typescript/native-preview
  3. Create a next.config.ts
  4. Start the dev server
  5. --> Next will install typescript again

Current vs. Expected behavior

I expected that the @typescript/native-preview can be used without typescript to be installed when using a typescript config file for next.js

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 16.1.1-canary.28 // Latest available version is detected (16.1.1-canary.28).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: N/A
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), next build (local)

Additional context

No response

extent analysis

TL;DR

The issue can be resolved by ensuring that the next.config.ts file is properly configured to work with @typescript/native-preview without requiring the separate installation of typescript.

Guidance

  • Verify that the next.config.ts file is correctly set up to use @typescript/native-preview by checking its configuration and dependencies.
  • Check the documentation for @typescript/native-preview to ensure it supports being used as a replacement for typescript in Next.js projects.
  • Review the package.json file to confirm that @typescript/native-preview is correctly installed and listed as a dependency.
  • Consider testing the setup with a minimal Next.js project to isolate the issue.

Example

No code snippet is provided as the issue is more related to configuration and dependency management rather than a specific code error.

Notes

The solution may depend on the specific versions of next, @typescript/native-preview, and other dependencies used in the project. Ensuring all dependencies are up-to-date and compatible is crucial.

Recommendation

Apply a workaround by reviewing and adjusting the next.config.ts and package.json files to correctly utilize @typescript/native-preview without needing typescript installed separately, as the direct fix seems to involve configuration adjustments rather than an upgrade to a fixed version.

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