TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Watch cannot handle large amount of file changes

Open 2767mr opened this issue 1 year ago • 1 comments

🔎 Search Terms

watch, tsc, tsserver, files, Cannot find module, or its corresponding type declarations

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about (tsc v5.4.5)

⏯ Playground Link

https://github.com/2767mr/tsbug

💻 Code

No response

🙁 Actual behavior

After deleting and regenerating a large amount of auto-generated files, typescript reports an error as seen below when using --watch. This also affects the VS Code tsserver.

src/main.ts:1:32 - error TS2307: Cannot find module './app/services/generated' or its corresponding type declarations.

1 import { TranslationDto } from "./app/services/generated";

🙂 Expected behavior

Typescript should pick up new files even when there are a lot of them.

Additional information about the issue

Reproduction:

  1. Clone https://github.com/2767mr/tsbug
  2. npm install
  3. Open one terminal with npm run watch
  4. After a few seconds, open another terminal with npm run copy

Here is the tsserver log that is created when doing this: tsserver.log

Possibly related issues: #57330 #22710 #37514 #54511 (same use case as we have - but on our end it does not work at all instead of being slow)

2767mr avatar Apr 27 '24 15:04 2767mr

Note that this bug does not happen if you reduce the amount of files that will be copied by npm run copy

2767mr avatar Apr 27 '24 15:04 2767mr

Some more information: I tried to reproduce this again because the blog post for the 5.5-RC mentions something similar to this issue.

I first tried to reproduce it again using v5.4.5 and noticed that the error only occured after I executed npm run copy the second time. From the on, every time npm run copy is executed, the error occurs. Restarting tsc --watch did not help with that.

I then tried to use typescript 5.5.1-rc but the issue still persists.

Something that might also be usefull when looking into this issue: I am using Windows 11 23H2 22631.3672.

2767mr avatar Jun 07 '24 14:06 2767mr

Thank you for repro as thats the most helpful and crucial in investigating such issues.

sheetalkamat avatar Sep 06 '24 18:09 sheetalkamat