You can interact with JS libraries, but exposing some API to JS-land is a completely different matter.
There are some vague plans to improve this, but there hasn't been much interest, because if you use Dart anyways, you do of course want to use it as the "host" language. It has the tooling and all that jazz. Of course you'd want to use it for as much as you can.
http://stackoverflow.com/questions/8815437/why-is-javascript...
> And the size of helloworld.dart.app.js is 102k
> When ran in optimize mode, it generated the following javascript - helloworld.dart.js which is of size 20k
No, it's not.
dart2js --minify hello.dart -o hello.dart.js
Results in a 5 KB JS file.This game is 35 KB (procedural graphics included):
264 Mar 5 12:21 a.dart
237K Mar 5 12:21 a.js
101K Mar 5 12:22 a.min.js
It was also slow to compile, 6 secs.Anything I'm missing?
Also note that you could now add a thousand lines of code and the file size wouldn't increase much. You already paid that one-time cost.
You can further improve the size by using a better minifier on top of --minify.
Though as a counterpoint (and relevant to angular 2 :) I read they're going to just use the raw dom api's instead of a jquery/jquery-lite abstraction layer as the dom api's don't need the smoothing over in modern browsers like they used to.
The main problem I had with Dart was [a year ago] that using existing JS libraries like jQuery wasn't as seemless as I would liked. So that would be a reason against Dart, if Angular wants to make that aspect easier.
Haven't looked at TypeScript's interop with JS. I got frightened by the name Microsoft and the fact that they only had a huge language spec PDF and not a single tutorial or something easier to digest.
In production, it's only ever transpiled to JavaScript.
> Chrome (dunno if enabled by default and/or in stable) contains a Dart VM, so you "only" need to transpile into JS for non-Chrome.
Not the real Chrome. A version of Chromium that you can use to make the development cycle smoother. When you deploy, you still transpile to JavaScript for all browsers.
All JavaScript is valid TypeScript. This was one of the founding tenants for TypeScript. So interop is "just use the JS".
You can optionally also provide a binding file that tells TypeScript about the JS code so that it can perform compile-time checking on calls. There is a repository of these bindings for common libraries called DefinitivelyTyped [0].
> ... They only had a huge language spec PDF and not a single tutorial or something easier to digest.
Not sure when you originally looked, but there is now a tutorial [1], handbook [2], and samples [3] in addition to the language spec [4].
[0] https://github.com/borisyankov/DefinitelyTyped
[1] http://www.typescriptlang.org/Tutorial
[2] http://www.typescriptlang.org/Handbook
[3] http://www.typescriptlang.org/Samples
[4] http://www.typescriptlang.org/Content/TypeScript%20Language%...
The question is not here, the relevant question is
"Does JS compiles in Dart ?"
Because, JS Compiles fine in TypeScript, which means Typescript benefits from all JS ecosystem and vice versa.