Should you use TypeScript for your next project? A simple guide for everyone

Should you use TypeScript for your next project? A simple guide for everyone

TypeScript has become one of the most popular technologies in the web development industry. Unless you’ve been away meditating in the Himalaya, you’ll definitely have heard of it and its relevance in 2022. It allows you to build more robust and less silly-bug prone apps. So, what is this magic? It’s TypeScript.

What is TypeScript?

TypeScript is a statically typed programming language built on top of JavaScript developed by Microsoft. In layman's terms it’s JavaScript with types and interfaces.

JavaScript itself was developed to be used as a simple scripting language on the client side and never intended for big enterprise applications. That’s why you might sometimes see those types of JavaScript memes.

That’s the problem that TypeScript tries to solve, aiming to build a more solid and robust language for developing applications.

TypeScript, the goodies

  • Static type checking: This is the reason why TypeScript was developed in the first place. By allowing type checking TypeScript encourages to write more declarative, explicit and clear code.
  • Awesome developer experience: With TypeScript the developer experience is just something else. For a developer, the Intellisense experience is also much smoother compared to using only JavaScript.
  • Reduced cost of development: this is one of the best things that come with TypeScript. According to a report, it can predict 15% of JavaScript bugs saving resources and time in development of applications.
  • Code predictability: With type checking you’re to be sure the type of data will go where it’s supposed to go. A number will remain a number, a string will remain a string and so on.

Of course as everything, TypeScript also has its pros and cons. First I mentioned the good stuff, now let’s see the cons.

TypeScript, the disadvantages

  • It’s just syntactic sugar: At the end of the day, all types and interfaces get compiled to plain JavaScript. The types only bring a false sense of security as the type checking only occurs at compile time and not at the runtime.
  • Steeper learning curve: Learning TypeScript is much more difficult than learning JavaScript as you’ve to learn not one but two “programming languages” at the same time: JavaScript and TypeScript.(I said two because you can’t learn TypeScript without knowing JavaScript!)

At the end of the day, it all depends on your needs

Summarising, I personally would only use TypeScript if my application has a lot of data flow and state management. With TS, this data flow would be much clearer and easier to manage.

For example,a project I can think of is an ecommerce, where you’d have to manage products, filters, carts and user state. 

This is it for this article, I hope it has helped you learn more about the TypeScript language and whether you should use it or not. Let me know in the comments what you think of this language!


To view or add a comment, sign in

More articles by Vikram S.

  • NextJS vs Create React App: Who wins?

    You can find many tools to help you build React apps. The most popular, and the best ones, are Create-React-App(CRA)…

Insights from the community

Others also viewed

Explore topics