[SOLVED] TypeScript support in modern browsers

Issue

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. What is the status of native TypeScript support by the modern browsers?

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

  3. What is the relation between TypeScript and ECMAScript 6 and does TypeScript provide much more features than ECMAScript 6?

Solution

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 6 MB of supporting JavaScript 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 JavaScript, so it’s supported by all browsers (even Internet Explorer 6).

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.

Answered By – basarat

Answer Checked By – David Goodson (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *