3 ms·
That's probably because TypeScript has more in common with CoffeeScript than Dart as a language. Dart is a full featured language that can stand on it's own an
by jmcqk6 13y ago
That's probably because TypeScript has more in common with CoffeeScript than Dart as a language. Dart is a full featured language that can stand on it's own and has it's own runtime.
TypeScript is a superscript of javascript. It doesn't have a runtime - it gets transcompiled into javascript. If coffeescript is for writing javascript like you would write python or ruby, then typescript is for writing javascript like you would C#.
I've used TypeScript on a large project I'm working on. Sometimes I regret it. I went with typescript mainly because I was not as confident that I could just jump into building a large JS codebase. Now that I've been in that world for a year, many times I'm wishing that I had just gone with JS from the start, or maybe limited my use of TypeScript to just type annotations.
- lucian1900 13y agoI haven't found any disadvantage to TypeScript over JavaScript. It's also trivial to switch, since compilation mostly just removes type annotations. I have however been annoyed at not being able to use sweet.js macros.
- jmcqk6 13y agoI'm still on an earlier version of TypeScript, so I don't know if later versions have fixed this. We ran into trouble when creating knockout view models in type script. Basically, TypeScript was losing track of 'this', and the trick of using var self=this in the the "constructor" wasn't valid. We made it work, but it wasn't pretty and it certainly wasn't idiomatic typescript. Basically the problem was that we were trying to write TypeScript like we were writing C#, instead of treating typescript like a layer on top of JavaScript.
- lucian1900 13y agoTypeScript's ES6 lambdas are actually closures over `this` as well, the compiler will insert `var _self = this;` in the enclosing scope if you have a lambda. Yeah, you do have to know JavaScript, since TypeScript only adds a few ES6 features and types.
- jvilk 13y agoEarlier versions of TypeScript had some significant typing issues in my experience, especially related to typechecking static fields on object instances (which you can't access through object instances -- you have to go through the class object). Since the 0.9.5 release, I don't think I've had any particular issues with typechecking or the language. And as someone mentioned, if you use lambdas, the compiler will automatically handle performing the `var _this = this;` trick for you under-the-hood. > we were trying to write TypeScript like we were writing C# Yeah, you really need to approach writing TypeScript as if you are writing idiomatic JavaScript. I'm happy that I went through the JavaScript mill before discovering TypeScript, as it informed how I developed my project.
- dpratt71 13y agoI've been using TypeScript (since v.9) on a project that uses Knockout.js extensively. In short, I really like it. The generics support in TS is quite good, which I think is very important for a framework like KO.
- recursive 13y ago> or maybe limited my use of TypeScript to just type annotations. I was under the impression that was most if not all of typescript. What else remains? Classes?`
- k__ 13y agoAFAIK modules