DEV Community

Discussion on: Practical Ways to Write Better JavaScript

Collapse
 
prahladyeri profile image
Prahlad Yeri • Edited

Aside from the overhead of adding types to your code, there are zero downsides to type-safety enforcement.

Au contrarire, the downsides of type-safety are too many compared to any benefits TS may have:

  1. Makes your code more verbose and unreadable due to various type declarations.
  2. Makes your code less expressive and more rigid.
  3. Not a W3C standard, imposed by a single corporation (Microsoft).

The Buddha's way is to face your maladies directly instead of creating abstractions around them. I'd rather write my code in ES6 than write TS and then convert to ES6!

Collapse
 
taillogs profile image
Ryland G • Edited

Makes your code more verbose and unreadable due to various type declarations.

Incredibly subjective.

Makes your code less expressive and more rigid.

I'm actually not sure how a typing system could make code "less expressive". Can you provide an example?

Not a W3C standard, imposed by a single corporation (Microsoft).

The language is open source, the spec of the language is open web. This statement entirely misrepresents TypeScript. Would you tell people not to use Java because it was created by Sun (now Oracle)? What about C#? What about JavaScript, a current trademark of Oracle?

The Buddha's way is to face your maladies directly instead of creating abstractions around them. I'd rather write my code in ES6 than write TS and then convert to ES6!

Au contrarire, you should be writing V8 bytecode. Or maybe even just skip all abstractions and send 1's and 0's via electrical current.

:)

Collapse
 
cubiclebuddha profile image
Cubicle Buddha • Edited

I disagree on this point.

“The Buddha's way is to face your maladies directly instead of creating abstractions around them.”

The Buddha would want you to “communicate mindfully” and to speak clearly. Types clarify reality which is what Buddhism teaches to respect: