Third-party libraries or specific engines might have a different opinion on where a statement ends, which translates to irregular behavior. A code might run in one environment and throw an error in another.
Remember the educated guesses I mentioned before? Imagine that one developer in a team makes a mistake that goes unnoticed because the code works as intended. Then, when the code is integrated into the project, the error still goes unnoticed.
Down the line the project scales, but this time around, the new code breaks down because it relies on the previous buggy code. Should be an easy fix, right? Maybe, unless another aspect of the project relies on the outcome of that odd behavior, in which case, changing it would break something else.
And so, one small and innocuous mistake snowballs into a full-on crisis. We would be telling a very different story if the language didn’t allow odd behaviors in the first place.
Remember that StackOverflow survey I mentioned before? TypeScript ranks as the third most loved programming language right behind Rust and Clojure. It’s the second most mentioned programming language when asked what technology developers would like to incorporate into their projects.
Think of TypeScript as an implicit communication tool. When a developer writes code in the language, other team members can be sure that nothing weird is happening under the hood. You can grab and use the code without having to check for abnormal behaviors first.
And that’s why TypeScript is such a great tool for scalable projects: its outputs are more reliable, and the code is easier to understand. If a developer declares that a variable is a number it’s not going to magically turn into a string.
A few cautionary words…
Having said that, most developers slowly but surely adapt their libraries to a typed style. As a quick example, Angular and Vue 3, two of the most popular front-end frameworks in the market, have migrated to TypeScript.
Even with its limitations, if you are working with a big project or one that is bound to scale, then I hope I have made the case for TypeScript. This superset, young as it is, is gaining momentum with each passing year and has become a standard for IT companies worldwide.