Home  >  Q&A  >  body text

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

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

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

仅有的幸福仅有的幸福2734 days ago711

reply all(7)I'll reply

  • 怪我咯

    怪我咯2017-05-15 17:00:43

    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.

    reply
    0
  • 怪我咯

    怪我咯2017-05-15 17:00:43

    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"

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-15 17:00:43

    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.

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-15 17:00:43

    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

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-15 17:00:43

    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

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-15 17:00:43

    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

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-15 17:00:43

    All syntax sugar is for ease of maintenance.

    reply
    0
  • Cancelreply