Cleaning up unused Typescript Files with `ts-prune`

coreyja

Corey Alexander

Posted on July 31, 2023

Cleaning up unused Typescript Files with `ts-prune`

TLDR: npx ts-prune will find us-used files in your Typescript project!


Recently at work I had some extra time on Friday. Not enough that I wanted to start a big task, but enough time to do some cleanup.

I found ts-prune which looks through a TypeScript project and finds things that are unused. It helped me find things that were completely unused and could be cleaned up, and some types there were being exported from their file but didn't need to be!

ts-prune is in maintenance mode, but I found it to work well for my usecase!

One caveat is that it just prints the files with errors to stdout, I had to go fix the issues manually. But well worth it for a more cleaned up repo!

💖 💪 🙅 🚩
coreyja
Corey Alexander

Posted on July 31, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related