vercel / vercel/next.js

Next.js TypeScript plugin diagnostics not reported by CLI / CI type checking with `tsc` or `next` subcommand

Open
#97,229 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

TypeScript
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/karlhorky/repro-next-js-typescript-plugin-diagnostics-no-cli

To Reproduce
  1. Open the reproduction sandbox at https://codesandbox.io/p/devbox/recursing-lamarr-3ypq8k?file=%2Fapp%2Fpage.tsx%3A3%2C18
  2. Use the Next.js TypeScript language service plugin: cmd/ctrl-shift-P -> TypeScript: Select TypeScript Version... -> Use Workspace Version
  3. Observe the The Next.js "metadata" export should be type of "Metadata" from "next". ts(71008) warning-level diagnostic in app/page.tsx
  4. Run pnpm tsc and observe no diagnostics reported 💥
  5. Run pnpm next check and pnpm next tsc and observe that these are not valid subcommands 💥
Image

Terminal output:

➜  workspace git:(main) ✗ pnpm tsc
➜  workspace git:(main) ✗ echo $?
0
➜  workspace git:(main) ✗ pnpm next check
Invalid project directory provided, no such directory: /project/workspace/check
➜  workspace git:(main) ✗ pnpm next tsc
Invalid project directory provided, no such directory: /project/workspace/tsc
Current vs. Expected behavior

The next TypeScript plugin reports Next.js-specific diagnostics through the editor TypeScript language service, but there is no command-line check that reports the same diagnostics.

I am aware that the TypeScript team have up until now (August 2026) rejected the feature request that tsc execute TypeScript language-service plugins:

I expected Next.js to provide a framework-aware CLI type check that includes its own plugin diagnostics, similar to the following prior art:

For Next.js this command could be something like next check or next tsc.

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

Additional context

Next.js's own TypeScript plugin tests already create a TypeScript LanguageService, wrap it with the next plugin, and call getSemanticDiagnostics():

https://github.com/vercel/next.js/blob/26824378a648f57c4595d5edd7fcfa20c96b71ba/test/development/typescript-plugin/test-utils.ts#L69-L100

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction and compare pnpm tsc with the editor diagnostic for app/page.tsx. Read test/development/typescript-plugin/test-utils.ts, especially its LanguageService setup and getSemanticDiagnostics() call, then review the existing CLI entry points. Done means a documented framework-aware command reports the same Next.js plugin diagnostics during local and CI type checking.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
cli, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.