DEV Community

Discussion on: TypeScript is a waste of time. Change my mind.

Collapse
 
sidhantpanda profile image
Sidhant Panda

This was quite the 'hot-take' on TypeScript. Lets go point by point

1: The pros aren't really pro
Big companies using it or not is a claim by people. Its got nothing to do with the language itself and as you rightly said, "Big companies also use legacy systems, therefore I should use legacy systems."
shouldn't be the reason to use it. With this you are fighting a mindset and not the language features themselves.

Why not just use Babel?
The following compiles with Babel:

const definitelyAString: string = 9;

The real pros is better code maintenance.

2: Typed JS is long and difficult to read.
This seems to really be a subjective one. I don't think I can change your mind about it. But a lot of us actually like the verbosity with interfaces to understand deeper into what all we can use and modify.

3: Typed JS is still... untyped.
As many others have pointed out, JS is not untyped, just dynamically typed. How does it matter how the variables are allocated in memory?

Adding interfaces and types to models is a one time affair. But the developer productivity post that is just incredible. Auto-complete shows all available members, and even description (if added as JSDoc comments). You will never run into a typo for accessing a data member from the model.

4. What's so bad about untyped JS?

  1. The time taken to add interfaces and types is time saved for anyone re-using that piece of code. So its a one time effort vs effort from multiple people multiple times.
  2. Seems to be true of any language. So it's neither a pro or a con?
  3. Seems to be a subjective one. So let's leave it be.
  4. You can't escape test cases in any language.

5. More importantly, look at design patterns and learn to spot code smells
Completely agree! This is true for any developer working on any kind of project.