re: Will Typescript Make Your Software Bug Free? VIEW POST

FULL DISCUSSION
 

The main benefit of TypeScript isn't that it catches type errors (though it does do that).

It's that it gives you confidence your understanding of a program is correct.

In a language with no static typing, to determine whether or not, say, a function parameter can be null, you have to audit every caller of that function. 1) you don't know where the callers are, because of dynamic dispatch and use of first class functions. 2) even if you can find all of the callers, you don't know anything about the arguments they pass until you read all of their callers.

This similarly makes it very difficult to refactor JavaScript, because the assumptions that the code makes aren't in the code (and it also makes it nearly impossible for IDEs to help, without messing it all up)

TypeScript means you can write, maintain, and read more complex code while worrying less. Making a change to one part of the code no longer requires reading the entire codebase, since type checking verifies that the boundaries maintain (and explicitly state!) their assumptions.

TLDR: TypeScript is the most effective way to write JavaScript. The code you make will be just as good as if it were written in JavaScript. However, when changing the code it lets you do more with exponentially less effort, because static analysis replaces exhausting manual busywork.

 

Absolutely right, the big plus about static typing is the refactor factor.

code of conduct - report abuse