DEV Community

Discussion on: Convince me that types are awesome

Collapse
 
leoat12 profile image
Leonardo Teteo • Edited

I think that with types you can organize entities important for the business much better and don't lose yourself in big projects. There is no such thing as "untyped" language in the strict sense, they all have types behind the scenes and you need to categorize things to have a better understand of the business logic. However, when it is dynamically typed you have to have a discipline about how you code so that it doesn't become a mess that statically typed languages already have out-of-the-box.
Once, I had the idea to convert one simple React project from JavaScript to TypeScript and it was absurd how many times I had difficulties and had to scream "where the hell this variable comes from!?". It is incredible how React itself take advantage of the fact that in Javascript you can declare anything, anywhere, or don't declare at all and get away with that. Sometimes it works, sometimes it just fails silently, where most of the time you get the error while coding in statically typed languages.