Am I correct in assuming that I will be able to switch from a typescript codebase to a pure ES6 codebase when it is supported enough by browsers? The question I am trying to answer to myself is whether I should I use typescript or ES6 + compiler to es3/5.
-
Your question does not provide enough detail. And it doesn't even fully make sense. When you say "pure ES6 based language" do you mean ES6? And your assumption about being able to switch from typescript to ES6 is not correct. The only answers would be opinion-based and not appropriate for StackOverflow. Please rephrase to something more concrete. – Andrew Eisenberg Apr 02 '14 at 16:13
-
@AndrewEisenberg by switching I mean easily transferring, not a straight swap – Nikos Apr 02 '14 at 16:16
-
There are language features in TypeScript that may never become part of the ECMAScript specification (for example, generics). I think it is likely that the TypeScript compiler will gain an `--target ES6` flag that leaves the ES6 features intact and transpiles the non-ES6 to idiomatic JavaScript. – Fenton Apr 02 '14 at 21:05
1 Answers
TypeScript is not ES6, as you presumably know. It tries to do most things in an ES6 friendly way, and has occasionally refrained from doing something because it couldn't be implemented in a way that wouldn't interfere with compiling down to ES6, but it has lots of features that ES6 does not have (such as static typing).
That said, yes, TS will eventually support compiling down to sane ES6 code. So you will be able to take your codebase and move it to ES6 in a reasonably straightforward way, just by taking the ES6 code that TS outputs (or will eventually output), and using that as your source.
I know some contractors who write all their JavaScript code in TypeScript, but because their employers only want JavaScript, they just compile it down to JavaScript, and then hand in the compiled JavaScript as their finished work product. And it's reasonable code, code that you could use as the basis for further development and maintenance. You will presumably be able to do the same thing with ES6. Not sure when that will be supported, of course.

- 20,305
- 15
- 100
- 147
-
1good points, I see that static typing should be in ES7, well hopefully with only targeting the evergreen browsers that won't be too far away. – Nikos Apr 02 '14 at 16:22
-
-
1No idea, unfortunately. Last I heard, ES6 wasn't expected to be formally accepted as a standard until EOY 2014. My guess is that MS will try to get to ES6 support after they finish working on the next major compiler version, which as I understand it will mostly be a drop-in replacement for the current version, but with significant performance improvements. – Ken Smith Jul 28 '14 at 04:17
-
-
According to the latest blog post from the TypeScript team, the releases will look something like 1.3 (almost out, I think), then 1.4, maybe 1.5, then 2.0 - and that ES6 support will be part of the 2.0 release. See http://blogs.msdn.com/b/typescript/archive/2014/10/22/typescript-and-the-road-to-2-0.aspx. – Ken Smith Nov 10 '14 at 15:39