microsoft / microsoft/TypeScript

Incorrect errors reported if typeckecking only single file

オープン
#55,069 コメント 0 件 リアクション 1 件 担当者 1 名 GitHub で見る

@sheetalkamat がすでに取り組んでいます。

2023年7月20日 から。

Needs Investigation
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。