Repository: TypeScript
Issue: Build hangs with no diagnostics
Labels: Bug,Rescheduled

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

<!--
  What search terms did you use when trying to find an existing bug report?
  List them here so people in the future can find this one more easily.
-->

### 🕗 Version & Regression Information
I have been incrementally implementing my `inferred-types` repo for a couple years. I basically just put in cool TS tricks when I find them. Ultimately this repo has a LOT of types and they are highly useful to me but for that past two months I have been in TS hell. 

First in the 4.x TS versions I ran into issues where the repo would crash with no reference to my code in the stack trace. I raised an issue and was happy to see it was fixed in the 5.x branch very quickly. Sadly it was only a few hours before I was without diagnostics again. This time the problem wasn't a crash but rather that **tsc** would just hang. I decided to first make sure that all my linting errors/warning were removed and then I followed that with a visual inspection of the extensive _type tests_ I have in the repo to try and spot errors. At this point I have done everything I know how to do, all tests appear to pass (both runtime and type tests). There are no linting warnings or errors in `src` or `test` and yet when I run either of:

1. `tsc -b -f -diagnostics`
2. `tsc --noEmit --diagnostics`

it just hangs (although potentially a red herring ... it's worth that as I've been bumping around in the dark and re-trying to run these commands ... occasionally it completes and the results are typically useful though it appears to pick up many false positives WRT to errors).

**Versions:**

typescript: `5.0.3`
node: `16.18.23`
OS: macOS Ventura `13.2.1`

As touched on above, this started becoming an issue for me in the late versions of TS 4.x but has continued into TS 5.x. For what it's worth, I am DYING to get this fixed as my backlog is now crazy. I'm very happy to create a top quality video on my lessons learned when I get there. Any links which might also help me monitor and optimize performance would be super useful too. For instance:

- I have no idea of how to expect the "TS cost" for statically importing a small set of types from a large library. Is the cost only associated to those types imported? 
- Is there a way to incrementally compiling sections of TS and then linking them together at the end?
- I am looking through this content on [Performance](https://github.com/microsoft/TypeScript/wiki/Performance) and hope to find some techniques to improve the efficiency of my types but really any good resources would be a real help.

Please keep and fill in the line that best applies:
-->
- This is a not a "crash" but **tsc** hangs (which is maybe even worse)
- This is the behavior in every version post 4.x and all 5.x versions

### ⏯ Playground Link

I'd love to be able to illustrate this in the playground but I have no idea how I'd do this (it's likely not possible). Fortunately it is very easy to reproduce with my repo:

[Repo](https://github.com/inocan-group/inferred-types/tree/33972e52c7e926114696fa1b87038605b074e7e7)

I use `pnpm` as a package manager so you'll be able to do a full reproduction with:

- `pnpm install`
- `pnpm diagnostics`

### 💻 Code

<!-- Please post the relevant code sample here as well-->
no idea as I am getting zero diagnostics from **tsc**

### 🙁 Actual behavior

running **tsc** never completes. No error messages, no warning messages, just silence.

### 🙂 Expected behavior

I'd be happy to get an error or warning that might help point me to what area of my code is causing problems. I do sort of suspect now that it might just be scale not a particular error but I'm just shooting in the dark.