简体   繁体   English

使用JavaScript或TypeScript的Angular 2.0?

[英]Angular 2.0 with JavaScript or TypeScript?

Which is the recommended way to develop angular 2.0 application. 这是开发angular 2.0应用程序的推荐方法。 is it with javascript or typescript. 是使用javascript还是打字稿。 i found difficult to start the angular 2.0 with typescript which is entirely different from the javascript. 我发现很难用打字稿来启动angular 2.0,这与javascript完全不同。

In fact, TypeScript is a superset of ES6. 实际上,TypeScript是ES6的超集。 In short, you will have the following in addition: 简而言之,您还将拥有以下功能:

  • Type checking (class properties, method parameters) 类型检查(类属性,方法参数)
  • Decorators 装饰工
  • Interfaces 介面

Perhaps the gap between ES5 and ES6 / TypeScript is important but there are really advantages to use it: ES5和ES6 / TypeScript之间的差距也许很重要,但是使用它确实有很多优势:

  • The compilation phase allows you to detect potential problems in your case 编译阶段使您能够发现案例中的潜在问题
  • TypeScript provides contracts (.d.ts files) of the elements / third-party libraries you use TypeScript提供您使用的元素/第三方库的合同(.d.ts文件)
  • Support of IDE for completion 支持IDE完成

That said, you are free to use either ES5, ES6 or TypeScript. 也就是说,您可以自由使用ES5,ES6或TypeScript。 It's up to you ;-) 由你决定 ;-)

I think the decision must depend on the knowledge and experience of your team so that you can make a close time estimation of your project and avoid unwanted issue that might occur in lack of knowledge and experience. 我认为决策必须取决于团队的知识和经验,以便您可以对项目进行及时的评估,并避免由于缺乏知识和经验而可能发生的不必要的问题。 Hope my suggestion will help you to decide. 希望我的建议能帮助您做出决定。 Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM