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

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.

主站蜘蛛池模板: 师宗县| 凤翔县| 栾城县| 灵璧县| 康平县| 乌审旗| 澄城县| 瑞金市| 六安市| 台东市| 昌黎县| 正阳县| 山西省| 巴塘县| 香格里拉县| 峨山| 大城县| 额敏县| 兴海县| 大关县| 蓬溪县| 大足县| 北宁市| 延安市| 沂水县| 册亨县| 吴堡县| 瓦房店市| 无极县| 醴陵市| 宣城市| 吉林省| 黑山县| 漳州市| 阳城县| 永靖县| 分宜县| 景泰县| 正安县| 丹寨县| 北海市|