While the question was "Are the purposes of the languages the same?", the real question is: "How can we make web programming better from where we are?".
Both projects try to do this considering
programming language (TypeScript makes a small but very clean step, Dart makes the more revolutionary move that is still moving)
interoperability with existing js code (0 transition in TypeScript which compiles to js, complicated in Dart, since 2 VMs talk to each other)
software engineering practices (Dart only, web components and shadow dom)
Over the last 3 days I dived deep into Dart and then into TypeScript. My CoffeeScript codebase went to 2000s lines of code, too much to be handled with lovely but too fluffy CoffeeScript. The problems I faced was that CoffeeScript lacks features that languages designed for medium to large scale programming have: interfaces, modules, type safety. But there was one even much more serious issue with coffee and js: The js "this pointer" weirdness affected my sanity and CoffeeScript does not help anything here.
So here my results after 3 days of eval and usage:
Went thoroughly through the tutorial, reading 1 book, skimming 2nd book and tried the demos. I thought, Dart that is the future. Then I tried to migrate my app to Dart. That was were my enthusiasm went down from 100 to 10. Here is why:
The Dart Editor is the only way to program Dart. While plugins for Sublime Text exist, they do not provide features like intellisense, code completion (correct me if I am wrong). The Dart Editor is however in pre alpha quality. While it does support supercool magic things like updating the web page when you edit the CSS file (! really cool) it hangs or crashes several times a minute. So you type 5 letters and 2 times you have to wait 2 seconds or 15 seconds between typing. And I had a project with some lines of code, so did not want to wait what happens when 1000s lines are in. Moved a file from one folder to the other inside Dart Editor, crash. Debugging with the Dart Editor is at first sight better than all js debugging tools I know (chrome is my choice), but there are still too many things missing: No immediate window (this makes js debugging much better at the moment), no watches.
print() statement still appears in Dart Editor, cool. But here comes the but: the footprint of such converted code is high. 150kB or so (before minification). I did not dig too much into the exact size, so do not nail me down on this.
Language Maturity. Beside the way too serious issues with Dart Editor popping into my face 3 times a minute I also found it unacceptable that every source about Dart code you find uses a different Dart. The language changes every day. You find a post from 5 weeks ago? It is outdated. You try the samples from the Google tutorial? At least 1 sample does not compile since an API changed. Even mundane things, like attaching an event to a DOM element are in good move.
Integration with existing js libraries is a bit involved. 2 VMs need to communicate here, its tricky.
As a conclusion, you cannot seriously use Dart as of today, and diving into it is not too much fun due to 1 and 3. Both points will disappaer over time. About the 2 point, Google published performance benchmarks some days ago demonstrating that their compiled js is better than handwritten js. My compliments, great job. Loading time might still be behind due to the footprint issue as said. However, if the footprint code gets used by many many sites, it might be available cached and voila, disappears as well.
So: I consider Dart a great project, using it at the moment carries a good portion of unforeseeable risk and it will take this year to get it to good stable level.
Interfaces. Encapsulation and interfaces allow me to structure my code easily. Perfect!
Class State.. TypeScript allows to express the state that instances of a class carry explicitly, or better it enforces it. This is a large step better compared to js or coffee.
this call craziness solved. TypeScript makes the
this pointer like any normally behaving citizen. Actually, this is my most important reason to use TypeScript.
Editor, Intellisense. TypeScript comes with 100% top perfect intellisense that reacts in the micro or millisecond range as used from Visual Studio when programming C#. TypeScript headers for all important js libraries exist too. Great great great.
Experience and Risk. Using TypeScript carries zero risk, the language is clearly defined, perfectly stable, it is just js with sugar, nothing unforeseeable.
Actually, these enhancements give me everything I needed. The only thing I would like to see in the future are generic collections. But that is peanuts.
So what about performance? While I consider myself a performance freak, I do not believe that there is any project that would make the technology choice here based on performance. Both are in the js liga.
If you are interested in the future of web programming, both are great efforts, TypeScript is much more pragmatic and usable now, Dart is a very interesting lab project that will be usable once mature editors and debuggers are available and the scope of projects doable with it will depend on politics.
In any case the 3 eval days were mostly fun and I learned a lot, if you find the time, it takes 1 day for Dart and 2 hours for TypeScript to make your own opinion. Try it.
Update October 2014
It has been a while and ex post it appears the assumption that Typescript is the safe stable route to go was quite right. I just found a (very) prominent statement about Typescript, Dart and Closure:
Michael Bolin is a long time (ex)google (ex)fb front end hero, also involved in google closure (get his book about Closure).
Google's appraoch to live ECMA Script 6 today is its Traceur project:
Compared to Typescript, tooling support is presumably far behind as of today. On the upside however, it is much faster in adopting overly cool future js language ehancements like iterators or comprehensions.
Facebook Flow, Google AtScript
provide similar features as TypeScript.
infoq article on fb flow