microsoft / microsoft/TypeScript
Typescript Server syntax highlighting bug: introduced by recent update
@mjbvz y travaille déjà.
Depuis le 8/4/2026.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.3k
- Merge moyen
- 2 j 4 h
- PR mergées (30 j)
- 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:
- Create a
@types/common/index.d.tsat the project root using thedeclare global {} export {}pattern to declare global types (e.g.IUser). - Configure
tsconfig.jsonwithtypeRootspointing to the directory andincludeset to only["src"]:
{
"compilerOptions": {
"typeRoots": ["./node_modules/@types", "./@types"]
},
"include": ["src"]
}
- Reference a global type (e.g.
IUser) in any.tsxfile insidesrc/. - Observe red syntax highlighting:
Cannot find name 'IUser'. - Run TypeScript: Restart TS Server — error persists.
- 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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Évaluation
Cette issue n'a pas encore été évaluée.