Why Typescript?

Llorenç Muntaner
3 min readJun 12, 2018

This is rather a personal opinion which derives of my own experience in software development.

I also expect that you already know what Typescript is, but you don’t need to be very familiar with it.

There are articles out there explaining why you should use Typescript for your project.

Tooling, makes code easier to read and understand, errors caught at compilation time, more suited for large projects than JS, …

All of them are good reasons to use Typescript.

There are also a lot of good reasons why not to use Typescript and plenty of articles explaining them.

In this article I’d like to share my personal view on Typescript and a reason that I haven’t read in any article so far.

How I got to Typescript

I learned to code with Ruby and Javascript during my development bootcamp (App Academy) almost 4 years ago. Those languages are not statically typed. I never had to worry about it. It was cool, it was flexible and it was fast. I was skeptical of statically typed languages from the first day. It seemed an extra burden.

When I started my current job last year at Onedot, they had the company policy of choosing statically typed languages and writing code in a functional style. For the backend they chose Scala and for the frontend they wanted me to work with Typescript even though I was not very comfortable with it.

After more than 1 year working with Typescript I have to say that I am elated to have learned Typescript (and Scala).

Why Typescript?

Typescript has made me a better developer.

Types are not just for tooling or catching errors at compile time. They are obviously not a substitution for proper testing.

Types make the developer think carefully about the code. Creating the interfaces of your app makes you aware of the the models you are working on. By adding the types of the parameters and returns values of a function makes it easier to understand what the function is supposed to do. When dealing with arrays and nested objects, creating the interfaces makes you aware of what is what and where are you at every step. When dealing with similar objects, it makes you think about why are they similar, does it makes sense to have 2 different ones? Should they be the same? Should they have a parent they both extend?

Thinking about the code is one of the key difference between a good and a poor developer.

Typescript has helped me develop faster.

Types make code more readable. It helps the developer remember faster what each piece of code is supposed to do. Hence, the developer can add and change current code faster.

The burden of having to write the interface and types is MUCH less than the benefit you take out of it. At least with the current Typescript community and DefinitelyTyped project.

Conclusion

I recommend Typescript to any development team creating a big project, even more when the team has junior developers not used to statically typed languages.

Typescript is an overkill for small projects. However, if the purpose of the small project is to practice and learn. Then it is perfectly suited.

More where this came from

This story is published in Noteworthy, where thousands come every day to learn about the people & ideas shaping the products we love.

Follow our publication to see more stories featured by the Journal team.

--

--