angular.js - 为什么Angular2和Ionic2都用TypeScript开发,TypeScript有什么优势吗?
仅有的幸福
仅有的幸福 2017-05-15 16:58:43
0
7
715

今天看Angular2和Ionic2都用TypeScript开发的。

为什么Angular2和Ionic2都用TypeScript开发,TypeScript有什么优势吗?

仅有的幸福
仅有的幸福

reply all(7)
刘奇

Completely based on es6, completely object-oriented, turning js into a strongly typed language, and compatible with the current js syntax, it can be compiled without having to use strong typing.

To put it simply, object-oriented is a good thing. Everyone has seen the maturity of C# and Java, but when looking at js, they feel that everything is cheating. es6 solves some of the pitfalls, while typescript solves almost all problems, turning js into a useful object-oriented language.

People who have learned object-oriented thinking when they see typescript will think that this is a normal language. After so many years, what is the es5 standard? . .

Of course, it’s not bad if you don’t use typescript and just use pure es6. Mainly because compared with the current es5, typescript appears to be particularly excellent.

刘奇

Personally, I think it’s because type checking was introduced in TypeScript. Regarding why type checking is needed, you can read this article "Why JavaScript needs types"

漂亮男人

The developer of TypeScript is the father of c#, so many of the language features of TypeScript were moved from c#. TypeScript is probably the implementation of ES7, so from a syntax perspective, it has great advantages. TypeScript can be optionally compiled into ES5 or ES3, ts files can be compiled into js files, and ts files can be debugged directly in the browser. Another major advantage of TypeScript is that it cooperates with VS, the most powerful compiler in the universe, and its development efficiency is very high. The only drawback is that there are too few people developing with TypeScript.

大家讲道理

Strictly speaking, Typescript / Javascript and Dart are supported in Angular2 at the same time
But for the time being, most of the official documents are Typescript

As far as I know, Google uses the Dart version internally

仅有的幸福

After strong typing, IDE can statically parse code and provide support for functions such as intelli-sense

You can get prompts when coding

Strong typing can help you create abstractions that are more explicit and conducive to long-term maintenance

https://www.delivoper.com/t/typescript/42

phpcn_u1582

Strong typing is a good thing. You don’t have to worry about various implicit conversion issues.
Static typing can provide editor static type checking, which can kill many bugs in the cradle.
The most important thing to add is that angular2’s type-based dependency injection is much more fun and safer than variable-based dependency injection

巴扎黑

All syntax sugar is for ease of maintenance.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template