Repository: TypeScript
Issue: Automatic Type Acquisition needs some kind of garbage collection/cleanup, at least for old typescript versions?
Labels: Suggestion,Experience Enhancement

# Suggestion

<!--
  Please fill in each section completely. Thank you!
-->

Automatic Type Acquisition automatically acquires necessary typescript types. That's great! The problem is that over the course of a few years of Typescript upgrades, my `AppData/Local/Microsoft/Typescript` folder had filled up with *hundreds of thousands of files*. This is actually a *huge* problem for several reasons:
- NTFS currently does *NOT* have a way to "clean up" old MFT entries. If the folder grows to contain more than a million or so files, your entire system will get permanently slower!
- It seems like Windows 10 likes to walk the whole AppData tree on login BEFORE even starting explorer, for me at least. It doesn't even do it in parallel (MSFT, please hire @ned14, lmao), so having hundreds of thousands of files to walk means I have to wait a whole lot longer to use my machine! If you have a bloated MFT, this gets even worse.


## 🔍 Search Terms

<!--
  💡 Did you know? TypeScript has over 2,000 open suggestions!
  🔎 Please search thoroughly before logging new feature requests as most common ideas already have a proposal in progress.
  The "Common Feature Requests" section of the FAQ lists many popular requests: https://github.com/Microsoft/TypeScript/wiki/FAQ#common-feature-requests

  Replace the text below:
-->

Automatic Type Acquisition

## ✅ Viability Checklist

<!--
   Suggestions that don't meet all these criteria are very, very unlikely to be accepted.
   We always recommend reviewing the TypeScript design goals before investing time writing
   a proposal for ideas outside the scope of the project.
-->
My suggestion meets these guidelines:

* [X] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [X] This wouldn't change the runtime behavior of existing JavaScript code
* [X] This could be implemented without emitting different JS based on the types of the expressions
* [X] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [X] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).


## ⭐ Suggestion

<!-- A summary of what you'd like to see added or changed -->
Something to clean up the leftover type declarations from old versions of typescript. Or unused declarations. [You could even use AgeStore](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/using-agestore)!

## 📃 Motivating Example

<!--
  If you were announcing this feature in a blog post, what's a short explanation that shows
  a developer why this feature improves the language?
-->

Remove hundreds of thousands of files from dev machines! C'mon, wouldn't that be nice?

## 💻 Use Cases

<!--
  What do you want to use this for?
  What shortcomings exist with current approaches?
  What workarounds are you using in the meantime?
-->
The current approach seems to be to just let them accumulate forever. I just noticed this when running altWinDirStat (my old project, and working on it back in the day is also why my MFT is *3.5GB*... trust me, a mechanical HDD with a 3.5GB MFT is insanely slow for everything), and trying to work around the slow login. I have just deleted several of the old TS folders, hoping to improve the situation without breaking anything. I haven't even checked if that broke anything before filing this bug.