TypeScript support in modern browsers

前端 未结 4 753
[愿得一人]
[愿得一人] 2020-12-29 19:25

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:<

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-29 19:56

    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.

    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.

    Not-native support

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

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

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

    No work is needed on behalf of browser vendors.

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

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

提交回复
热议问题