DEV Community

Discussion on: To Typescript Or Not To?

 
stojakovic99 profile image
Nikola Stojaković

Those are the good points to consider about TS!
Even you adding more importance to strong typing that it would had on a good and tested software -regardless of the size- I'll explain myself.

Nope - in fact, if you look at my profile, you'll see that I left comment before in one thread where I mentioned the importance of testing. I never said that static types are more important than testing nor that they're sufficient.

I add the importance on static typing because it's been proven over and over that static typed programming languages are better for large scale projects.

strong typing would never be a need, because you understand the software you work in and knows how it works

It would be a need even in that case because humans are not perfect - even with the properly written tests it would be possible to make bunch of mistakes and to pass data of wrong types. Static typing prevents you from making dumb mistakes in the first place.

The need of adding strong typing raises to the moon when we have junior devs, rushing bosses, bad company culture and so on.

No, the need of adding strong typing exists because it has been shown that large scale project written in dynamic typed languages are much harder to maintain. That's one of the reason why TS even came to existence - Microsoft had huge JS code bases and saw how unmaintainable they become after some time (and I'm pretty sure Microsoft engineers do write tests and documentaion).

Types allow you to describe the data and relationship between different data. This allows you to much better predict possible pitfalls (for example, to check if your switch case incorporates all posible cases like Rust does) and so on.

What you're basically saying is that all these static typed languages in the existence today came to be just because there were some cranky bosses and junior devs who couldn't program in dynamic typed lanugages, which couldn't be further from the truth.

Apart from that, for a given piece of software you can discern how big it will be, you always can connect different software made with different technologies without issues so as long as it's decoupled enough and well scoped in it's tasks it will be fine either way.

You can't easily predict how big some software will be. Also, decoupling is a hard process. I know this because I have worked on many microservice based architectures. One bad step and it's easy to make a huge number of errors.

If you need (need is the keyword here) strong typing, you should be working on something that implicitly needs it for any reason or something bad is happening in your development process. Knowing the cause of this need could be a game changer for you and your teammates.

It makes work much easier in the long run. That alone is one of the reasons why I prefer it over the dynamic typing. Sure, that doesn't mean I don't use dynamic typed languages at all - I have a game which is written in Ruby for example.

Thread Thread
 
joelbonetr profile image
JoelBonetR 🥇

Thanks for this kind of comments Nikola, in this discussion I'm playing the role of devil's lawyer but I know those things, I have a career since long time ago. In this platform sometimes I get frustrated because there are many people blind-following things and not even analysing what they should do. Explanations like yours, mines sometimes and other few should get more visibility.

I'll try to pick some time in few days and extract excerpts about all this post in a manner of question/concern -> answer, trying to add external sources for further information and so on for those who want to get more than a surface knowledge and understand the concepts.

In the meantime I'll try to counter some points of view to see how people argue it's opinions or experiences and let's see what can we learn about all those chunks of text! :)

I'll mention you all when this job is done