现代浏览器中的TypeScript支持 [英] TypeScript support in modern browsers

查看:356
本文介绍了现代浏览器中的TypeScript支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚阅读了一些与TypeScript相关的广告信息,此外,我没有使用此JavaScript超集的经验.所以我有一些基本问题:

I've just read some advertisement information related to TypeScript and besides that I have no experience with this superset of JavaScript. So I have some basic questions:

  1. 现代浏览器对本机TypeScript的支持情况如何?
  2. 主要的浏览器供应商对于本地原生支持TypeScript持何立场?
  3. TypeScript和ECMAScript6之间有什么关系?TypeScript是否提供比ECMAScript6更多的功能?

随时回答所有或部分问题.谢谢.

Feel free to answer to all or to the subset of questions. Thanks.

推荐答案

本地支持

可以很容易地添加本机支持,例如 https://github.com/basarat/typescript-script 添加了对脚本标签的支持(尽管在页面上添加了6MB的支持JS).但是,将TypeScript编译为JavaScript会对性能产生影响,为了获得最佳性能,最好在浏览器中预编译并执行已编译的JavaScript.

Native support

Native support can be added quite easily e.g. https://github.com/basarat/typescript-script adds support for script tags (although this adds 6MB of supporting JS to a page). However there is a performance hit in compiling TypeScript to JavaScript and for the best performance it is best to precompile and execute the compiled JavaScript in the browsers.

浏览器供应商没有计划添加本机TypeScript支持.在浏览器中唯一通用的本地语言是JavaScript和WebAssembly.可以将TypeScript转换为任意一种,然后在浏览器中运行,这样它就不会成为阻止程序.

Browser vendors have no plans to add native TypeScript support. The only native languages common across browsers are JavaScript and WebAssembly. TypeScript can be transpiled to either and run in the browsers so its not a blocker.

现代浏览器对TypeScript支持的状态如何?

What is the status of TypeScript support by the modern browsers ?

Typescript可以编译为JS,因此所有浏览器(甚至是IE6)都支持

Typescript compiles to JS so it's supported by all browsers (even IE6)

主要的浏览器供应商对TypeScript的未来支持持何立场?

What are the positions of the major browser vendors for the future support of TypeScript ?

不需要代表浏览器供应商的任何工作.

No work is needed on behalf of browser vendors.

TypeScript和ECMAScript6之间有什么关系?TypeScript是否提供比ECMAScript6更多的功能?

What is the relation between TypeScript and ECMAScript6 and does TypeScript provide much more features than ECMAScript6 ?

是,例如从未来的javascript版本中类字段和类中的静态属性.

Yes e.g. from future javascript versions e.g. class fields and static properties in classes.

这篇关于现代浏览器中的TypeScript支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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