TypeScript: Project compiles OK but hangs when --watch is added
TypeScript Version: 3.0.0-dev.20180616 and 2.9.2
Search Terms: typescript watch --watch hangs stalls slow
Hi I have minimized one of my projects to an example source (which I have attached [1]) that:
- Compile fine when not using watch mode (takes about 5 seconds to compile on my machine)
- Hangs the compiler when using watch mode (doesn’t complete it’s compile).
To compile the example:
- download the zip and unzip it and enter that directory
- run
yarn installto add the project’s deps. 3a. runyarn tsc-okfor the example where it does compile 3b. runyarn tsc-badfor the example where it doesn’t
BTW: Is there some way for me to tell the compiler to dump out the source files it is processing as it processes them? It would be extremely helpful for tracking this down to the specific issue.
1: Source Code: tsc-watch-hangs.zip
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 4
- Comments: 33 (16 by maintainers)
Hey @benjaminjackman @pelotom I’m struggling with similar issues
Something that really helped with spinning up watch is to mask MST models behind interfaces, especially for composited models. (is a similar manner to your examples )
i didn’t check how its effect decelerations emits, just tsc -w startup times (from forever to 10 secs) and im still playing with it.
A quick and minimal example:
And if we could hint typescript to create intermediate type names instead all of it, that would be great!
I made a gist that describes how to use chokidar to call tsc --noEmit whenever a file changes in case anyone stumbles into this ticket:
And it is definitely ultimately the structural decomposition of classes that ends up as the issue here (aggravated by the combinatoric expansion masked via the conditionals) - I experimentally disabled that feature in our declaration emitter (it is just one of the flags set at the top), and while it introduced some errors (as some types became unprintable), it also let it build pretty much instantly with
declarationon. 😦