Yes, You Should Use TypeScript

Yes, You Should Use TypeScript

Why you should always pick TypeScript over JavaScript in 2023

·

3 min read

Featured on Hashnode

The developer community has been set abuzz by DHH's recent Twitter announcement: Turbo 8 will not be using TypeScript. This has reignited a classic debate among developers—TypeScript or JavaScript?

While the question may seem simple—"Are types really necessary?"—it's a multi-faceted issue that deserves deeper exploration. With that said, let me make a case for TypeScript, a technology that many, including myself, believe brings undeniable advantages to the development experience.

Types Exist: The Unavoidable Truth

Firstly, whether you're an ardent TypeScript supporter or a dyed-in-the-wool JavaScript developer, the undeniable truth is types exist. They form the framework of our coding logic, governing how we interact with variables, invoke functions, and even structure entire programs. Now, the question isn't really about the existence of types, but rather, when do you want to know about type errors?

Catch Errors Early with TypeScript

TypeScript provides the benefit of compile-time type checking. Imagine knowing you have spinach in your teeth before walking into a meeting rather than finding out afterwards. That's what TypeScript offers—a chance to catch and rectify errors early, during development, saving you from the embarrassment of runtime crashes or even worse, production failures.

Sure, you can write unit tests in JavaScript to catch type issues. But then you find yourself asking: why not just use TypeScript in the first place and catch these issues even earlier?

The Rich Developer Experience

Ever had your GPS guide you smoothly around traffic, and thought, "Wow, what did we do before this?" That's what working with TypeScript feels like. The rich IDE support with features like Intellisense and autocomplete not only speeds up the development process but also makes it more accurate and efficient.

Matt Pocock sums this up beautifully in this tweet. The DX of TypeScript is so good that 70% of respondents in the State of JS 2022 said that they use TypeScript over JavaScript.

One Language to Rule Them All

The power of TypeScript shines exceptionally bright when you're dealing with monorepos that include web apps, mobile platforms, APIs, data layers, and even infrastructure as code. Why? Because TypeScript allows you to use one language across your entire stack, and in a type-safe way. This is nothing short of a superpower in the realm of development. Think about it: consistency, reduced context switching, and increased productivity—TypeScript offers all these benefits and more.

I can't imagine, in 2023, building software outside of the TypeScript/monorepo ecosystem. Once you've experienced being able to build a feature, from client to server to infrastructure to database, all in the same repository, in a fully type-safe way, there's no going back.

Community Reactions

The tech community's response to this development has been nothing short of enthusiastic, with many individuals sharing their thoughts and experiences. Here are a few of the most compelling and insightful reactions that I found to be particularly interesting:

Conclusion

While DHH's announcement about dropping TypeScript from Turbo 8 has sparked renewed debate, it also provides an opportunity for reflection. TypeScript isn't just a trend or a buzzword; it's a tool that offers tangible advantages such as early error detection, a more robust IDE experience, and a unified, type-safe language for monorepos.

So, coming back to our original question—do we really need types? With TypeScript, the answer seems to be a resounding "Yes, and they offer so much more!" Whether you view it as a safety net or an enabling superpower, TypeScript stands out as an incredibly valuable tool for modern development.

Did you find this article valuable?

Support Alex Kates by becoming a sponsor. Any amount is appreciated!