Choosing between TypeScript or just blasting ahead with raw JavaScript usually
comes down to how long the tool is actually going to live. I have a habit that
might sound contradictory: I often ignore tsc if I feel the required build
step isn't worth the utility of the tool itself.
I’ve lost many small internal tools simply because the setup was too much of a headache. I once built a simple banner generator; it was meant to be helpful, but because the initial configuration took so much time, hardly anyone used it. That taught me not to force TypeScript into everything from the start.
If it’s just a small file, I'm the only one writing it, and the runtime is obvious (like Node.js), using raw JavaScript just makes more sense. Especially if there are very few dependencies. For example, if I just need a single HTML file with a script module to convert CSV to JSON, or a quick Node ESM script to read, transform, and rewrite a file—using TypeScript feels like using a bomb to kill a mosquito.
Of course, raw JavaScript has its downsides. Renaming variables becomes risky
because you don't have the automated safety to ensure everything updates
correctly. Your editor can't help much, and you aren't forced to think about
potential null values or weird data types. To get around this, I usually keep
my modules small, use very explicit function names, and manually test the most
critical parts.
I have my own rule of thumb. If the code is just a browser module script or a very specific Node CLI, I stick to JS. But the moment that code starts being used by two different applications, or it's treated as an actual library, my mindset shifts. That’s the point where I have to get serious about data types.
Usually, there are four signs that tell me it's time to move to TypeScript: when a third party starts using my code, when the data structures get complicated, when refactoring takes longer than actually adding new features, or when a new person reading my code clearly struggles to understand it.
Productivity isn't about using the most sophisticated tech; it's about how few things you have to manage to solve a specific problem. Not everything needs heavy packages or complex tooling. If it's just for a one-off task or a cheap prototype, there’s nothing wrong with sticking to raw JavaScript.
Just keep an eye on how the code is being read and used. If it starts to "grow" and becomes a burden, that's when you move to the TypeScript typing system.