So I've been doing my research and apparently coffeescript is dying/dead.
Typescript seems to be coming out on top but is this just from hype and the masses or is it actually (in most respects) the best?
Are there other alternatives I've missed?
I also saw that using a combination of babel+ES6 and typescript could be a great idea - thoughts?
Is it worth going to a strongly typed language at all?
With the given project I'm working on I also intend to bring in rollup.js towards completion in order to minimise the code as much as possible.
Also, how do all of these affect debugging?
In a browser I can just open the dev console and being to play around. But browsers don't have native support for these languages and I do a lot of debugging so I would assume any time I want to change something I'd need to recompile the code and test it that way. Instead of the usual way to debug javascript in the dev console.
I was working on a project using Angular 1, when someone just said: Angular 2 is out. It was such a mind shift for me. I went to the then Angular website and there were three streams to working with Angular at the time: you could use Typescript, Dart or just javascript. As far as I know, Angular's compiler just compiles any of those combinations to javascript. I used Dart for another small project for fun, so I chose Dart with Angular 2, and just stuck with it. Dart is amazing. Anything you can do in Typescript, you can do in Dart and more. Both compile to javascript if you work in straight Typescript or straight Dart... and I suppose you can use a compatible library with either if you have need to.
Typescript is great. We use it on both the client and server in combination with babel. Typescript implements a lot of the great ES6 features, but only those that aren't Stage 0. This is where babel comes in. If you want to use things such as Async functions and await, you need to use babel because Typescript does not support them yet. However, I believe typescript 2.1 is supposed to come with a lot of new hot features, wish will allow use to remove quite a few babel plugins and let typescript take over without changing any code. Having a strongly typed language when building a large application has been amazing, I can't tell you how many times the Typescript compiler has led me directly to a problem that would have taken me 5 or 10 times as long to debug without it.
I like the following sentence a lot: "It depends on your project" :)
If you have a very small module, you could go for CoffeeScript. It is ultimatively an uglified version of JavaScript, leaving out a lot of semantic overhead resulting in smaller code which can be easier to read. But only when the code is small either way. I would not recommend it at all for bigger projects.
Dart actually has yet to see some more love. I haven't played around with it a whole lot, but I'd say it is very comparable to TypeScript; but it's Google instead of Microsoft, so maybe the decision between those two might be more of a political decision... One argument against Dart might be that it does not have the same traction and a smaller community. But it depends on your project if something like that really matters...
Then there is the odd one out: Babel. Babel is not a language. It is a mere tool. Babel is nice if you want to transpile stuff, but when you have official tools (like the TypeScript transpiler by Microsoft), you just do not need it. Imho, Babel shines when you want to use ES6 / ES7 features, but have to support old clients.
You also listed Clojure, which I have absolutely no experience with, so I will leave it out for now.
To put it in a nutshell, since you want to move away from JavaScript, you might want to consider using either TypeScript (going with the hype; TypeScript is still based on ES) or Dart (very nice language by one of the companies driving the Internet).
Personally, I would stick with vanilla JS as ES6 adds a whole lot of very nice features. If you really have to, you can use Babel to transpile it to ES5 for older browsers.
Here is an interesting read for you!
PS.: I get the feeling that you seem to have a missunderstanding about ES and JS. ES is not a language. It is just a standard! JS and many other languages build on that standard. The so-called JS2015 builds on the ES6 standard. TypeScript also builds on ES. Afaik Dart does not build on ES, but was standardized by the Ecma Consortium (correct me if I am wrong).
Why use TypeScript?
Don't overcomplicate things. Use ES6. If you want imports/exports - bundle app with rollup.js, if you need to support old browsers and transpile code to ES5 - add polyfills you need and use babel plugin for rollup. Don't need to use Babel itself. That's all, everything is very simple and you won't have any problems writing your code and debugging.
There are lot of IDEs with ES6 support and ESlints to help you, for example, not to forget to pass all the required variables into function and will provide a nice error during compilation.
Also use doc comments and this will give you a warning whenever, for example, you will be trying to pass a String into something expecting a Number.
I think typescript is a nice choice, it's one of the angular 2 supported languages or scripting language and i don't think it's only the hype if google go with it, for other side ES6 and more it's cool because it's the new features of javascript.
Dart user here, everything you like about Typescript, you can find in Dart (Dart does it better IMO), if you use one of the Jetbrains IDEs, you get remote debugging (which means you can attach a debugger, add breakpoints and step through the code and view / change variables while stepping through the code from the breakpoint), you get obervatory out of the box which will allow you to do check for leaks or anything that could be slowing down your code.
Just like JavaScript, you don't have to recompile anything, just hit refresh in the browser and your changes will be there. Browser console is still available and if you use Dartium, you can actually click on the error and it'll highlight where in the Dart code the error occurred.
Unlike TypeScript, you also get polyfilling, so if a feature is partially supported in browsers but Dart offers that feature, Dart will generate workarounds in your generated JavaScript to make it work in those other browsers as well.
You don't need rollup with Dart, Dart already does a fantastic job minifying your generated JavaScript and using some plugins in the pubspec.yaml, you can also minify your CSS, compile SASS and LESS file without needing an external tool for that - simply run
pub buildand all those things are taken care of for you.