microsoft / microsoft/TypeScript

Incorrect errors reported if typeckecking only single file

Offen
#55,069 0 Kommentare 1 Reaktion 1 zugewiesene Person Auf GitHub ansehen

@sheetalkamat arbeitet bereits daran.

Seit 20.7.2023.

Needs Investigation
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

Bug Report

🔎 Search Terms
🕗 Version & Regression Information
  • This is a crash
  • This changed between versions ______ and _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______
⏯ Playground Link

Playground link with relevant code

💻 Code

Dont have reduced repro but here is how to repro:

In Typescript Repo checkout commit at 4879087
Run tsc -b -v src\server
Edit src\server\project.ts to add some comment somewhere (Error is reported only when doing typechecking on this file without typechecking all files in the project)
Run tsc -b -v src\server

// We can quickly address your report if:
//  - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!
//  - It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.
//  - The incorrectness of the behavior is readily apparent from reading the sample.
// Reports are slower to investigate if:
//  - We have to pare too much extraneous code.
//  - We have to clone a large repo and validate that the problem isn't elsewhere.
//  - The sample is confusing or doesn't clearly demonstrate what's wrong.
🙁 Actual behavior
src/server/project.ts:1668:13 - error TS7023: 'addMissingFileWatcher' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.

1668     private addMissingFileWatcher(missingFilePath: Path) {
                 ~~~~~~~~~~~~~~~~~~~~~

src/server/project.ts:1674:15 - error TS7022: 'fileWatcher' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.

1674         const fileWatcher = this.projectService.watchFactory.watchFile(
                   ~~~~~~~~~~~

🙂 Expected behavior

No Errors

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.