vercel / vercel/next.js

TypeScript VS code extension does not work properly for API routes

Open
#77,199 0 comments 3 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/jakeleventhal/next-types-issue

To Reproduce

Open app/page.tsx and app/api/route.ts and observe no type errors in route.ts in your IDE.

Image
Current vs. Expected behavior

I expected the revalidate export to show a type error in both app/page.tsx and app/api/route.ts, but only the page.tsx shows an error.

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.4.0: Tue Mar  4 21:05:34 PST 2025; root:xnu-11417.100.576.505.3~2/RELEASE_ARM64_T6000
  Available memory (MB): 65536
  Available CPU cores: 10
Binaries:
  Node: 20.18.1
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: 9.15.9
Relevant Packages:
  next: 15.3.0-canary.10 // Latest available version is detected (15.3.0-canary.10).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.8.2
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

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 linked reproduction and open app/page.tsx and app/api/route.ts in VS Code while running the reported next dev setup. Compare the TypeScript diagnostics for the revalidate export in both files; the issue is done when the expected error appears in the API route as well as the page.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript, vscode
Domain
api, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.