我应该用打字机吗?或者我可以只使用ES6? [英] Should I use typescript? or I can just use ES6?

查看:125
本文介绍了我应该用打字机吗?或者我可以只使用ES6?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的日常工作是使用AngularJS的客户端开发人员。我们正在评估我们是否要使用TypeScript。我对typcript做了一些研究,几乎每个JavaScript包都需要有定义类型的文件。我发现这不是很方便,特别是如果我想尝试新的东西,他们没有它的定义。真的很沮丧(即使是目前的jQuery定义,如果我想使用typescript 1.5 beta,也给我一些问题)。我开始看ES6,看起来类似于TypeScript。我应该使用ES6吗?此外,我听说角度2将完全支持TypeScript,这将是我应该留下来的一个原因吗?

My daily job is client developer using AngularJS. We are evaluating if we want to go with TypeScript. I did some research on typescript and almost every JavaScript package I need must have definition type files. I found that is not very convenient, especially if I would like to try something new and they don't have the definition for it. Its really frustrating. (Even the current jQuery definition gives me some problems if I want to use typescript 1.5 beta). I started looking at ES6 and it looks similar to TypeScript. Should I just use ES6 instead? Also, I heard angular 2 will have full support for TypeScript, will that be one reason I should stay with it?

推荐答案

我在我目前的角色项目中一直使用Typescript约一年半,而每个定义都有一些问题,然后 DefinitelyTyped 项目在跟上最流行的图书馆的最新版本方面做得非常出色。

I've been using Typescript in my current angular project for about a year and a half and while there are a few issues with definitions every now and then the DefinitelyTyped project does an amazing job at keeping up with the latest versions of most popular libraries.

说了一个明确的学习从vanilla JavaScript转换到TS时,您应该考虑到您和您的团队进行转换的能力。另外,如果要使用角度1.x,您将在线查找大部分示例,您将需要将其从JS转换为TS,并且总体而言,目前还没有很多资源将TS和角度1.x一起使用

Having said that there is a definite learning curve when transition from vanilla JavaScript to TS and you should take into account the ability of you and your team to make that transition. Also if you are going to be using angular 1.x most of the examples you will find online will require you to translate them from JS to TS and overall there are not a lot of resources on using TS and angular 1.x together right now.

如果您计划使用角度2,则有很多使用TS的示例,我认为该团队将继续提供TS中的大部分文档,但您当然不必使用TS来使用角度2.

If you plan on using angular 2 there are a lot of examples using TS and I think the team will continue to provide most of the documentation in TS, but you certainly don't have to use TS to use angular 2.

ES6确实有一些不错的功能,我个人打算更熟悉它,但我不会认为它是此时生产就绪语言。主要是由于目前的浏览器缺乏支持。有关详细信息,请参见 SO答案。当然,您可以在ES6中编写代码,并使用一个转换器来获取ES5,这似乎是现在流行的一件事。

ES6 does have some nice features and I personally plan on getting more familiar with it but I would not consider it a production ready language at this point. Mainly due to a lack of support by current browsers. See this SO answer for more details. Of course you can write your code in ES6 and use a transpiler to get it to ES5, which seems to be the popular thing to do right now.

总的来说,我认为答案会降低你和你的团队的舒适度。我个人认为,TS和ES6都会有很好的支持和长期的期望,我更喜欢TS,因为你倾向于更快地获得语言功能,现在的工具支持(在我看来)更好一点。

Overall I think the answer would come down to what you and your team are comfortable learning. I personally think both TS and ES6 will have good support and long futures, I prefer TS though because you tend to get language features quicker and right now the tooling support (in my opinion) is a little better.

这篇关于我应该用打字机吗?或者我可以只使用ES6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆