官术网_书友最值得收藏!

Compile-time type checking

One of the most common mistakes we make while writing JavaScript code is to misspell a property or a method name. Usually, we find out about the mistake when we get a runtime error. This can happen during development as well as during production. Hoping that we will know about the error before we deploy our code to the production environment isn't a comfortable feeling! However, this is not a problem specific to JavaScript; it is something common to all the dynamic languages. Even with lots of unit tests, these errors can slip by.

TypeScript provides a compiler, which takes care of such mistakes for us using static code analysis. If we take advantage of static typing, TypeScript will be aware of the existing properties a given object has, and if we misspell any of them, the compiler will warn us with a compile-time error.

Another great benefit of TypeScript is that it allows large teams to collaborate since it provides formal, verifiable naming. This way, it allows us to write easy-to-understand code.

主站蜘蛛池模板: 遵义县| 横山县| 桂平市| 永嘉县| 沙田区| 钦州市| 天津市| 龙井市| 临海市| 临夏县| 西华县| 尼木县| 上高县| 尼勒克县| 江川县| 南投县| 嵩明县| 大渡口区| 东丽区| 宝山区| 综艺| 同江市| 普兰店市| 库车县| 宁武县| 望江县| 无锡市| 洪泽县| 浑源县| 福泉市| 大方县| 磐石市| 迭部县| 上思县| 南部县| 普洱| 洪江市| 淳化县| 南宫市| 渑池县| 鹤岗市|