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

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.

主站蜘蛛池模板: 湘阴县| 临城县| 延吉市| 甘孜县| 夏河县| 鸡西市| 北宁市| 乌拉特后旗| 梁山县| 通河县| 莫力| 通城县| 泉州市| 新绛县| 大方县| 招远市| 西乌珠穆沁旗| 武夷山市| 平陆县| 衡阳市| 龙泉市| 唐海县| 南和县| 肇东市| 云浮市| 沙河市| 上饶县| 和田市| 新沂市| 阜南县| 陆良县| 和静县| 临潭县| 湾仔区| 保山市| 修水县| 当涂县| 邵阳市| 江山市| 滨州市| 临颍县|