Of course, there are always exceptions. A looser language probably would’ve been a better choice for my self-modifying simulation adventure from a few years ago.
Anyway, back to TypeScript. It just seems to take the biggest pain point with JS and pretty much eradicate it completely.
- Static typing
- Straightforward member visibility
- Finding more issues at compile time vs stumbling across them at runtime.
I recently converted a couple of code bases to TS and even though the vanilla JS version seemingly “worked”, during the conversion process TS flagged issues that made me question how my previous implementation ever ran…accidental reuse of functions as variable names, using vars that were never defined, etc…But it “worked”! Imagine how much time this probably saved me debugging tiny runtime issues down the line.
TypeScript has also made me curious about other languages that can compile to JS, like Kotlin and Go (which I still love dearly).