DISCLAIMER

: I don't work on TypeScript. I am not involved with that team and this is all my own opinion and conjecture.

免责声明:我不使用TypeScript。 我没有参与该团队,这是我自己的观点和推测。

UPDATE: After this post I sat down with Anders in Denmark at the GOTO 2012 Conference sin Aarhus and asked him bunch of questions about TypeScript. That recorded audio podcast is now available.

更新:发布这篇文章后,我在2012年GOTO会议上与丹麦的安德斯(Anders)在奥尔胡斯(Sing Aarhus)坐下,并问了他一系列有关TypeScript的问题。 录制的音频播客现在可用。

TypeScript was announced and folks are saying "TypeScript is clearly Microsoft's answer to Google's Dart" or "So TypeScript is Microsoft's answer to CoffeeScript."

TypeScript被宣布,人们说“ TypeScript显然是微软对Google Dart的答案”或“所以TypeScript是Microsoft对CoffeeScript的答案”。

I was chatting with Jez Humble today about the intense interest and some little gnashing of teeth around TypeScript and he offered this little gem of a quote:

今天,我与Jez Humble聊起了有关TypeScript的浓厚兴趣和一些咬牙切齿的事情,他提供了这个报价的小宝石:

It's disappointing when smart people display a profound ignorance of computing history. - Jez Humble

当聪明人对计算历史表现出极大的无知时,这真令人失望。 -杰兹·汉布尔

TypeScript has been out a day. It's way early to see if it has legs, but it seems initially promising.

TypeScript已经一天了。 现在来看它是否有腿还很早,但最初似乎很有希望。

TypeScript和Dart (TypeScript and Dart)

People have compared TypeScript to Dart. That's comparing apples to carburetors. TypeScript builds on JavaScript so there's no JS interop issues. Dart is a native virtual machine written from scratch. Dart interops with JavaScript...but it's not JS. It doesn't even use the JavaScript number type for example.

人们已经将TypeScript与Dart进行了比较。 那是将苹果与化油器进行比较。 TypeScript基于JavaScript构建,因此没有JS互操作问题。 Dart是从头开始编写的本地虚拟机。 Dart与JavaScript互操作...但是不是JS。 例如,它甚至不使用JavaScript数字类型。

TypeScript和CoffeeScript (TypeScript and CoffeeScript)

I'm a huge CoffeeScript fan although it is a different language with a syntax of its own to learn. What I like about TypeScript - so far - is that TypeScript’s static typing could enable better tooling with warning squiggles, easy statement completion, plus smart refactoring. You also get easy navigation around code, as well as find references, rename, and more. You don’t currently get that in CoffeeScript.

我是CoffeeScript的忠实拥护者,尽管它是另一种语言,具有自己要学习的语法。 到目前为止,我对TypeScript的满意之处在于TypeScript的静态类型可以通过警告字形,轻松的语句完成以及智能重构来实现更好的工具。 您还可以轻松浏览代码,以及查找引用,重命名等。 您目前没有在CoffeeScript中得到它。

那么什么是TypeScript? (So what is TypeScript?)

TypeScript is a superset of JavaScript and you write it like you write JavaScript which I like. Any existing JavaScript is already TypeScript. One argument has been made that TypeScript is for people who don't want to learn JavaScript. I don't buy that. As Ward Bell said in an email:

TypeScript是JavaScript的超集,您可以像编写我喜欢JavaScript一样编写它。 任何现有JavaScript已经是TypeScript。 有一种说法认为TypeScript适用于不想学习JavaScript的人。 我不买正如Ward Bell在电子邮件中所说:

TypeScript is not a crutch any more than JSLint is a crutch. It doesn’t hide JavaScript (as CoffeeScript tends to do). - Ward Bell

TypeScript不是拐杖,而JSLint是拐杖。 它不会隐藏JavaScript(CoffeeScript倾向于这样做)。 -沃德·贝尔

I think Ward says it well. Folks rail against static typing but they don't complain about JSLint. TypeScript offers optional type annotations - it's hardly a perversion of JavaScript.

我认为沃德说得很好。 人们反对静态类型,但是他们没有抱怨JSLint。 TypeScript提供了可选的类型注释-几乎不是JavaScript的变种。

From what I can see after using TypeScript for a few days is this. It gives you type checking, explicit interfaces and easier module exports. In fact, it's a little like getting some of tomorrow's ECMAScript 6 early in a way that's compatible with today's JavaScript. ES6 won't be out for at least a year but we can play with some of those features today.

从使用TypeScript几天后可以看到的是这个。 它为您提供类型检查,显式接口和更轻松的模块导出。 实际上,这有点像以与当今JavaScript兼容的方式及早获得明天的ECMAScript 6。 ES6至少会发布一年,但是我们今天可以使用其中一些功能。

Things that I like about TypeScript:

我喜欢TypeScript的事情:

  • It's Open Source and under the Apache 2.0 license 它是开源的,并且在Apache 2.0许可下
  • You can install the tools easily with

    您可以轻松地安装工具

    • npm install typescript -g npm安装打字稿-g
  • You can git the source

    您可以混入源代码

    • git clone https://git01.codeplex.com/typescript  git clone https://git01.codeplex.com/typescript
  • You can play with it online at http://www.typescriptlang.org/Playground

    您可以在http://www.typescriptlang.org/Playground上在线玩它

Things I don't like about TypeScript (these are mostly implementation things)

我不喜欢TypeScript的东西(这些大部分是实现的东西)

  • No splitscreen editor like Visual Studio's existing CoffeeScript editor

    没有像Visual Studio现有的CoffeeScript编辑器那样的分屏编辑器

    • UPDATE: While this isn't "official" support, Mads has updated Web Essentials 2012 with a splitscreen editor. The two teams are going to work together on a more official solution.

      更新:虽然这不是“官方”支持,但Mads使用分屏编辑器更新了Web Essentials 2012 这两个团队将共同努力,寻求更正式的解决方案。

    No splitscreen editor like Visual Studio's existing CoffeeScript editor

    没有像Visual Studio现有的CoffeeScript编辑器那样的分屏编辑器

  • Doesn't generate .js on save, requires a build.

    在保存时不生成.js,需要构建。

    • UPDATE: The Web Essentials extension does this for us.

      更新: Web Essentials扩展为我们完成了此任务。

  • You have to add a BeforeBuild target to your ASP.NET application's CSPROJ: 您必须向ASP.NET应用程序的CSPROJ中添加一个BeforeBuild目标:
<Target Name="BeforeBuild"><Exec Command="&quot;$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc&quot; @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" /></Target>

I will continue to use TypeScript and evaluate it, but I think the fact that it's open source, it creates JavaScript and it feels comfortable to me as a C# programmer means it will fill a useful niche.

我将继续使用TypeScript并对它进行评估,但是我认为它是开源的,可以创建JavaScript,而且对于C#程序员来说,我觉得很舒服,这意味着它将填补一个有用的领域。

This quote from Luke Hoban, co-creator of TypeScript really hits the spot.

TypeScript的共同创建者Luke Hoban的这段话确实很引人注目。

"CoffeeScript is to Ruby as TypeScript is to Java/C#/C++." - Luke Hoban

“ CoffeeScript适用于Ruby,而TypeScript适用于Java / C#/ C ++。” -卢克·霍班(Luke Hoban)

If you love Ruby, you'll enjoy CoffeeScript as it makes the JavaScript more like the Ruby. The same is true with TypeScript. It brings useful features into JavaScript in an ultimately compatible and syntax-friendly way using language constructs you're comfortable with.

如果您喜欢Ruby,那么您会喜欢CoffeeScript,因为它使JavaScript更像Ruby。 TypeScript也是如此。 它使用您习惯的语言构造以最终兼容且语法友好的方式将有用的功能引入JavaScript。

翻译自: https://www.hanselman.com/blog/why-does-typescript-have-to-be-the-answer-to-anything

为什么TypeScript必须是所有问题的答案?相关推荐

  1. 什么是TypeScript?为什么我要用它代替JavaScript? [关闭]

    本文翻译自:What is TypeScript and why would I use it in place of JavaScript? [closed] Closed . 已关闭 . This ...

  2. JS面试题汇总(四)

    往期点这里:↓ JS面试题汇总(一) JS面试题汇总(二) JS面试题汇总(三) 31. JS 单线程还是多线程,如何显示异步操作 参考答案: JS 本身是单线程的,他是依靠浏览器完成的异步操作. 解 ...

  3. [转]信息安全相关理论题(三)

    21.静态分析是运行程序后进行调试? A. 对 B. 错 您的答案: 标准答案: B 22.安卓反编译后会出现$符号字节码表示是匿名内部类? A. 对 B. 错 您的答案: 标准答案: A 23.反编 ...

  4. 分享 25 道常见的 TypeScript 面试题及答案

    TypeScript 是一种静态类型的.面向对象的编程语言,它是 JavaScript 框架 之一,它添加了可选的静态类型和其他功能.它由微软开发和维护,并迅速成为世界上最流行的编程框架之一. 因此, ...

  5. 2023高频经典前端面试题(vue2+vue3+typescript+nodejs下篇,含答案)

  6. c# typescript_在任何IDE中从C#,Java或Python代码获取TypeScript接口的简单方法

    c# typescript by Leonardo Carreiro 莱昂纳多·卡雷罗(Leonardo Carreiro) 在任何IDE中从C#,Java或Python代码获取TypeScript接 ...

  7. 使用TypeScript映射和条件类型使React组件更出色

    by Deepu K Sasidharan 通过Deepu K Sasidharan 使用TypeScript映射和条件类型使React组件更出色 (Make your React component ...

  8. typescript 叹号_TypeScript系列(五)最佳实践

    前言 在进入主题之前,我们先来简单回顾一下前四篇文章想要表达的主题: 当Redux遇到TypeScript:这篇文章从redux的action出发,介绍了as和可判别联合类型(Discriminate ...

  9. 尤雨溪回应:Vue与TypeScript为什么相性特别差?

    近日,有开发者在知乎上提出了一个问题:"TypeScript 不适合在 vue 业务开发中使用吗?",Vue的作者尤雨溪针对这一问题发表了自己的看法,也解释了Vue 3.0选用Ty ...

最新文章

  1. 面试官:连框架都没用熟练,就这还来面试?
  2. 哪一个不是html5新增的语义化标记元素,东师19春《HTML5开发基础与应用》作业考核【标准答案】...
  3. c++ 字符串数组长度排序_数组 | 后缀数组的求法及应用
  4. 解决python调用TensorFlow时出现FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecate
  5. Flink从入门到放弃之源码解析系列-第1章 Flink组件和逻辑计划
  6. 音视频技术开发周刊 | 228
  7. html5里面em是什么单位,HTML5中单位em的理解
  8. script中的event和for的意思
  9. java 错误日期转正确日期_java – jdk8日期转换中的错误?
  10. MySQL数据库与Oracle数据库中建表使用单引号和双引号的效果
  11. 【求最大公共子串长度】
  12. 论文笔记:Securing Data With Blockchain and AI
  13. 一点浩然气,千里快哉风(修炼孟子浩然之气)
  14. 世界著名黑客的安全建议
  15. Microsoft Excel 教程:如何在 Excel 中创建图表?
  16. 计算机系统-大作业-hello的一生-哈尔滨工业大学2020级
  17. DAY41:Cobalt Strike 工具使用
  18. 网页+微信小程序UI设计及前端开发(第二周)
  19. 【云原生】设备入云之FlexManager主流控制器读写
  20. PTA 7-46 请输出郑州轻工业大学OJ平台网址

热门文章

  1. oracle创建自增序列并每日刷新
  2. Android的http网络请求失败
  3. 美术宝软件测试面试流程怎么样,“倒数第一”试卷走红,老师气得找家长,美术老师却表示有前途...
  4. 淘宝直播如何设置录制回放功能,进行无人直播
  5. all3dp.com网站中全部Arduino项目(2022.7.1)
  6. 苹果推出iPhone 12,价格比你想象中更实惠
  7. 服务器中了勒索病毒,malox勒索病毒的加密方式及如何应对勒索病毒攻击
  8. 张孝祥整理java面试题
  9. Excel中如何批量合并单元格
  10. Markdown插入图片 详细例子(本地图片,网络图片,base64) Windows