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:
What is the status of native TypeScript support by the modern browsers?
What are the positions of the major browser vendors for the future support of TypeScript natively?
What is the relation between TypeScript and ECMAScript 6 and does TypeScript provide much more features than ECMAScript 6?
You cannot use Typescript in Chrome. Typescript is superset of JS and you must first compile .
To run TypeScript in a browser, it needs to be transpiled into JavaScript with the TypeScript compiler (tsc). In this case, tsc creates a new . js file based on the . ts code, which you can use any way you could use a JavaScript file.
All the modern browsers come with built-in support for JavaScript. Frequently, you may need to enable or disable this support manually. This chapter explains the procedure of enabling and disabling JavaScript support in your browsers: Internet Explorer, Firefox, chrome, and Opera.
Activate JavaScript in another browserMicrosoft Edge. Mozilla Firefox. Apple Safari.
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.
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.
Trying to design a web browser that could natively support more than one language at a time is exactly what Google tried to do with Dart. There was a Dart engine planned for Chrome, but this ended up being too big a task with very little benefit aside from "just not using JavaScript".
I suspect supporting TypeScript natively would be an equally daunting task. Probably better to just improve upon ECMAScript and add in a few TypeScript ideas where they make sense. I do love TypeScript though.
TypeScript cannot be run or understood in any browser. So, TypeScript is compiled to JavaScript (which browsers can understand). TypeScript can use all ECMAScript 2015 features and during the compilation they will be converted to target compile options like ES5.
Currently it won't work, but it's an interesting topic though. It would be good to know if at some point ECMAScript is going to support interfaces, types and other things. Especially, I can notice that ECMAScript actually slowly takes some parts from the TypeScript, e.g. enums.
If it would work, I'd rather see it as ECMAScript taking some stuff from TypeScript rather than natively supporting TypeScript itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With