DEV Community

How programming is better with TypeScript ?

Kat Holder on July 30, 2021

TypeScript is a typed superset of JavaScript by definition. As a result, all current JavaScript is TypeScript compliant. Also, you may transform an...
Collapse
 
spock123 profile image
Lars Rye Jeppesen

Once you go Typescript you never go back.

Collapse
 
maciekgrzybek profile image
Maciek Grzybek

💯 agree with that, at least with relatively bigger projects

Collapse
 
spock123 profile image
Lars Rye Jeppesen • Edited

I just converted a large backend API from JS to TS.
I cannot count how many bugs I could fix out of the box, just by all the places where non-existing object properties were accessed, function parameters were omitted etc.

Thread Thread
 
maciekgrzybek profile image
Maciek Grzybek

Exactly that :)

Collapse
 
adparris profile image
Andrew Parris

Agreed!

Collapse
 
krd8ssb profile image
Steven Brown

Once you really start using TypeScript, you'll never look at JavaScript the same. However, it's important to note that while it will help you identify bugs during development, it does not do runtime validations. When your application is being used after it has been compiled to JavaScript, TypeScript is no longer helping you so you still need to sanitize and validate your data.

Another thing to keep in mind is that TypeScript is not a replacement for tests. Unit tests, integration tests, contract testing, e2e testing, etc... are all still incredibly important and should not be skipped.

Collapse
 
necross220 profile image
Obed David Pérez Uri

Agree many dev blame Javascript specially devs coming for c# and asp. Net the reality is that you don't know how to program anything that doesn't take your hand all the way long... Same history is true for php and python many devs hate them but it is because it will not hold your hand "you are a developer make and store you code for future use and solutions" it has been said

Collapse
 
itays123 profile image
Itay Schechner

Well, I'm afraid I disagree. By "TypeScript compliant", they mean you can import javascript files to typescript and the other way around, but not nessecairly each piece of Javascript code will compile.

Regarding the Javascript classes - coming from a Java background, the value of Javascript classes is worth less compared to Java. Typescript offered the OOP features of Java with the flexibility of Javascript.

About your other points - direct them to the author:)

Collapse
 
itays123 profile image
Itay Schechner

100% truth.

Collapse
 
adparris profile image
Andrew Parris

As most likely do, I struggled with TypeScript at first. But now, several months in, I kind of feel naked and unprotected without it. It's my default now.

Collapse
 
sturzaam profile image
Sturzaam

Hopefully this is just bad English.

"saving you time from writing tests"

Nothing, except ignorance, should save you from writing tests! If you're not writing tests, then don't push.