microsoft / microsoft/TypeScript

Incorrect errors reported if typeckecking only single file

Abierto
#55,069 0 comentarios 1 reacción 1 asignado Ver en GitHub

@sheetalkamat ya está trabajando en esto.

Desde el 20/7/2023.

Needs Investigation
Lenguaje dominante
Go
Estrellas
111k
Forks
14.4k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.