DEV Community

Discussion on: TypeScript and why you should type your JS project

Collapse
 
migueldevelopez profile image
MiguelDevelopez

Thanks for the constructive critic, I will update the advantages of TS to make it more clear with some examples and statistics about bugs

I reply to another dev to a similar question so I will copy-paste the answer:
Yes, I guess you are right, I miss the point of the title during the process trying to explain how simple is to write in TS instead of JS.
As you can see with TypeScript we can define the interfaces for parts of our program, so we can be sure that they interact correctly. It means they will have clear contracts of communication with each other which will significantly reduce the number of bugs. TS + unit tests will do the code more stable, predictable and probably will reduce the amount of pre-release bug density.

Any suggestion to improve the example related to the function minus?

Collapse
 
andrei_says profile image
Andrei Andreev

Hi Miguel, thanks for the reply.

  1. Name the function “add” so that it does what it says.

  2. What are some common places in a web app which benefit from typing and make the time investment of using typescript worth it? Examples?

Most of us don’t get type errors in our code. TS is a significant overhead. Why the overhead if no benefit? Adding busy work does not make me happy.

Why are all these developers so happy? Code examples where the extra hours of using TS actually save time?