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

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.

主站蜘蛛池模板: 乌审旗| 鄂尔多斯市| 曲沃县| 丹棱县| 麻栗坡县| 横峰县| 高阳县| 梓潼县| 兰州市| 台江县| 永昌县| 凤翔县| 乐东| 乐安县| 东阳市| 收藏| 威海市| 平安县| 襄樊市| 怀远县| 扎兰屯市| 固原市| 财经| 永定县| 浦北县| 攀枝花市| 翁牛特旗| 西丰县| 沧源| 九龙坡区| 大冶市| 大宁县| 东阿县| 清徐县| 黄梅县| 景洪市| 隆回县| 敖汉旗| 嘉祥县| 错那县| 德江县|