Description
Bug Report
The basic problem looks like this:
- I run
tsc
directly from the command line and get Set A of errors. - VSCode instead shows Set B of errors which can be wildly different than Set A
- If I issue the TypeScript: Restart TS Server command to VSCode, I will then start to just see Set A errors in my IDE
- However... if I go and make a small change to a file I start only seeing Set B errors again.
Set B errors seem completely wrong since the tsc
doesn't produce them. HOWEVER, a specfically unique error in Set B seems to be causing this weird behavior:
'Value' implicitly has type 'any' because it does not have a type annotation and is referenced directly
or indirectly in its own initializer.ts(7022)
If I solve this error with an explicit type assertion, the inconsistency goes away and I resume seeing Set A errors.
My project does rely on a deep set of types involving conditionals and generics. This seems to have something to do with causing this problem. I've provided a repository below with steps on how to reproduce. I would try to narrow the behavior down to a simpler project+repo but do not have the time at the moment.
🔎 Search Terms
inconsistency, inconsistent, errors, ts language server,
🕗 Version & Regression Information
This issue was tested and occurs in TypeScript 4.9 and the latest nightly build as of this writing (5.0.0-dev.20230216).
⏯ Playground Link
Unfortunately I'm unable to reproduce this with the TS Playground
Repo+Branch that reproduces the issue
- Navigate to
Stepper.ts
line 77. See the TSDoc comment there for reproducibility steps. It can some times take a few file modifications to trigger the behavior. - I was able to reproduce the same issue using GitHub Codespaces.
💻 Code
See Repo above.
🙁 Actual behavior
- TypeScript errors reported by VSCode are inconsistent with the ones reported by running
tsc
via the command line. - VSCode can be temporarily made consistent by restarting the TS Server.
- A single error seems to be causing TS+VSCode to act in this way.
🙂 Expected behavior
- TypeScript errors reported by VSCode should always match with the ones reported by running
tsc
via the command line.