microsoft / microsoft/TypeScript

Typescript Server syntax highlighting bug: introduced by recent update

Open
#63,382 3 comments 3 reactions 1 assignee View on GitHub

@mjbvz is already working on this.

Since Apr 8, 2026.

Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.115.0 (Universal) — Commit 41dd792b5e652393e7787322889ed5fdc58bd75b — 2026-04-07
  • OS Version: macOS Tahoe 26.1 — Darwin arm64 25.1.0

Environment:

  • TypeScript: 6.0.2
  • React: 19.2.4
  • Vite: 8.0.3

Steps to Reproduce:

  1. Create a @types/common/index.d.ts at the project root using the declare global {} export {} pattern to declare global types (e.g. IUser).
  2. Configure tsconfig.json with typeRoots pointing to the directory and include set to only ["src"]:
{
  "compilerOptions": {
    "typeRoots": ["./node_modules/@types", "./@types"]
  },
  "include": ["src"]
}
  1. Reference a global type (e.g. IUser) in any .tsx file inside src/.
  2. Observe red syntax highlighting: Cannot find name 'IUser'.
  3. Run TypeScript: Restart TS Server — error persists.
  4. Run Developer: Reload Window — error persists.

Expected: TypeScript Server resolves global types from typeRoots and shows no syntax highlighting errors.

Actual: TypeScript Server fails to resolve global types from typeRoots when the directory is outside include, producing incorrect Cannot find name syntax highlighting errors. The project runs without errors at runtime.

Workaround: Adding the typeRoots directory explicitly to include resolves the syntax highlighting errors:

"include": ["src", "./@types"]

typeRoots alone should be sufficient for the TypeScript Server to resolve these types.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.