News for hackers. Stuff that matters.
Re:TypeScript included with Visual Studio 2013 Update 2 by judah on Friday February 28, 2014 @11:04AM (#7319512)
While baking TypeScript into Visual Studio isn't a certainty of its future success (e.g. Silverlight), it is a good indicator of Microsoft's commitment to the language.

As a former CoffeeScript user, I love TypeScript: it's a more consistent language driven by a real language designer, Anders Heijlsberg, author of Turbo Pascal, Delphi, C#, and now TypeScript.

I am building 2 major projects using it:

- RavenDB Management Studio [1] - BitShuva, my Pandora-clone radio startup [2]

Both of these projects have benefited from TypeScript.

Microsoft has really built something quite nice here: a clean JavaScript with an optional, flexible type system, plus goodies from the future version of JavaScript (lambdas, classes, modules). I believe this simpler approach is superior to Dart's monolithic standard library + optional VM, superior to the Rubyist's take on JavaScript that is CoffeeScript.

[1]: https://github.com/JudahGabriel/ravendb/tree/Raven.Studio.Ht... [2]: http://bitshuva.codeplex.com

Re:TypeScript included with Visual Studio 2013 Update 2 by rubiquity on Friday February 28, 2014 @11:39AM (#7319789)
> "As a former CoffeeScript user, I love TypeScript: it's a more consistent language driven by a real language designer"

I have a lot of respect for Anders Hejlsberg but this is a pretty unfair slight against Jeremy Ashkenas just because he hasn't created another language before. CoffeeScript was pretty revolutionary in its approach, as evidenced by the 30+ other to-JS languages that followed it. As long as you agree with its ideaology it is well designed.

I'd also argue that a community, and at the very least a team, is what designs a language and not just a single person. The language might start as a vision by a single person but ultimately it is driven by something more collaborative.

To be the contrarian here, the belief of "fixing" a dynamic language by adding static types to it is a bunch of crap.

Re:TypeScript included with Visual Studio 2013 Update 2 by Locke1689 on Friday February 28, 2014 @12:49PM (#7320277)
I'd also argue that a community, and at the very least a team, is what designs a language and not just a single person. The language might start as a vision by a single person but ultimately it is driven by something more collaborative.

I disagree and think it's a good way to make a language bad. The first way to make mistakes in a language is not to look at the math. The second way is to have no "taste."[1] Communities are not widely regarded for their ability to design cohesive tasteful systems. That comes from a singular vision that is realized by a community.

[1] It's hard to provide a succinct definition of taste in a language, but mostly it comes from picking a style of programming and then ruthlessly cutting features which can't fit into that style.

Re:TypeScript included with Visual Studio 2013 Update 2 by jvilk on Friday February 28, 2014 @01:39PM (#7320616)
I also switched two of my research projects over to TypeScript from CoffeeScript [1,2]. I'd like to state up-front that CoffeeScript still has its merits in certain scenarios; they are two very different projects, despite both providing convenient `Class` abstractions over prototype-based inheritance.

With that said, using TypeScript has vastly decreased the amount of mental state I need to keep in my head when I develop one of my projects. The compiler uses the type annotations to double-check my logic, and Visual Studio gives me the ability to easily refactor interfaces as if I were using a statically typed language [3]. I could go on... but I will spare you the blog post. :)

I really wish there was a free or cross-platform alternative to Visual Studio for TypeScript autocomplete and IntelliSense. The WebStorm IDE claims to support TypeScript, but it gives me tons of incorrect compilation errors in my current projects. I hope it matures so there is an alternative. Anyone working on TypeScript tooling that is comparable to VS for different editors (e.g. Sublime)?

EDIT: Whoa, I completely missed this in the blog post; palantir is developing an Eclipse plugin [4]. They also developed a tool that converts CoffeeScript projects to TypeScript; interesting [5].

[1] https://github.com/int3/doppio Doppio: A JVM in TypeScript

[2] https://github.com/jvilk/BrowserFS BrowserFS: A full-featured file-system in your browser that emulates the Node fs API

[3] I'm referring to trivial refactorings -- renaming function/variable names and such. Refactors that are more complex, such as changing the function signature, must be done manually at call sites, but the compiler will catch your errors if you mess up or forget one.

[4] https://github.com/palantir/eclipse-typescript

[5] https://github.com/palantir/coffeescript-to-typescript

Re:TypeScript included with Visual Studio 2013 Update 2 by sequence7 on Friday February 28, 2014 @02:30PM (#7320910)
There's a brackets[1] plugin[2] that looks like it might have potential.

[1] http://brackets.io [2] https://github.com/fdecampredon/brackets-typescript

Re:TypeScript included with Visual Studio 2013 Update 2 by reddit_clone on Friday February 28, 2014 @01:48PM (#7320663)
There is some emacs support for TypeScript. Not sure how good it is.
Re:TypeScript included with Visual Studio 2013 Update 2 by jvilk on Friday February 28, 2014 @01:53PM (#7320692)
I think it's just syntax highlighting, like the current ST support [1]. There's notable vim support [2], but... I prefer GUI editors for IDE-style development.

[1] http://blogs.msdn.com/b/interoperability/archive/2012/10/01/...

[2] https://github.com/leafgarland/typescript-vim

Re:TypeScript included with Visual Studio 2013 Update 2 by radicalbyte on Friday February 28, 2014 @02:10PM (#7320793)
We've been using TypeScript here at triggre.com. We're really pleased with it. The type system catches a lot of errors that would have otherwise cost a lot of QA time to identify.
Re:TypeScript included with Visual Studio 2013 Update 2 by k__ on Friday February 28, 2014 @11:13AM (#7319589)
I like the ideas of Dart much more, but the JavaScript-interop is rather bad in Dart, because of the DartVM focus.

TypeScript seems C# flange-mounted on top of JavaScript, but it's probaby the only viable alternative with good js-interop...

Re:TypeScript included with Visual Studio 2013 Update 2 by jmcqk6 on Friday February 28, 2014 @11:20AM (#7319644)
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.

Re:TypeScript included with Visual Studio 2013 Update 2 by lucian1900 on Friday February 28, 2014 @11:28AM (#7319697)
I 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.

Re:TypeScript included with Visual Studio 2013 Update 2 by jmcqk6 on Friday February 28, 2014 @11:56AM (#7319909)
I'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.

Re:TypeScript included with Visual Studio 2013 Update 2 by jvilk on Friday February 28, 2014 @02:01PM (#7320746)
Earlier 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.

Re:TypeScript included with Visual Studio 2013 Update 2 by lucian1900 on Friday February 28, 2014 @12:40PM (#7320219)
TypeScript'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.

Re:TypeScript included with Visual Studio 2013 Update 2 by dpratt71 on Friday February 28, 2014 @07:35PM (#7322494)
I'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.
Re:TypeScript included with Visual Studio 2013 Update 2 by recursive on Friday February 28, 2014 @11:54AM (#7319902)
> 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?`

Re:TypeScript included with Visual Studio 2013 Update 2 by k__ on Friday February 28, 2014 @12:53PM (#7320301)
AFAIK modules
Re:TypeScript included with Visual Studio 2013 Update 2 by CmonDev on Friday February 28, 2014 @11:34AM (#7319754)
The only thing needed now is a higher-level version of HTML... Something like XAML for instance.
Re:TypeScript included with Visual Studio 2013 Update 2 by keithwarren on Friday February 28, 2014 @01:23PM (#7320499)
You say XAML in jest but once you get over the learning curve, it is incredible expressive, it will make you hate HTML and CSS.
Re:TypeScript included with Visual Studio 2013 Update 2 by mattmanser on Friday February 28, 2014 @04:15PM (#7321550)
Yeah, but that learning curve is a real bitch.

As much as I hate HTML I never struggled with it quite as much as I struggled trying to feel productive with Silverlight 2/3 for the first 3 months.

But as you say, once you're finally over the hump, it makes you really despise the utter stupidity of HTML and the w3c's design by committee.

Re:TypeScript included with Visual Studio 2013 Update 2 by pjmlp on Friday February 28, 2014 @05:32PM (#7321996)
Fully agree. XAML is great after one understands how all pieces fit together.

Sadly I get mostly paid to do web stuff.

Re:TypeScript included with Visual Studio 2013 Update 2 by EdwardDiego on Friday February 28, 2014 @10:43PM (#7323016)
The last time I used it, the styling had some flaws. Trying to set an element's top and bottom border to one colour, with the left and right borders set to another was impossible, as you couldn't address individual sides, only the whole element's border.

The 'fix' was to create two line elements over the borders you wanted coloured differently.

Re:TypeScript included with Visual Studio 2013 Update 2 by tvxedoman on Friday February 28, 2014 @11:54AM (#7319904)
Like HAML or Jade?
Re:TypeScript included with Visual Studio 2013 Update 2 by CmonDev on Friday February 28, 2014 @12:17PM (#7320063)
Do they have: 1) strong IDE support 2) rich control libraries ?
Re:TypeScript included with Visual Studio 2013 Update 2 by bjcy on Friday February 28, 2014 @12:44PM (#7320242)
XAML doesn't necessarily have strong IDE support, either. Although integrated into VS, it really is no comparison to the "REPL" of HTML/CSS + your favorite text editor and a browser.
Re:TypeScript included with Visual Studio 2013 Update 2 by Spearchucker on Friday February 28, 2014 @12:52PM (#7320295)
Not sure I understand your use of REPL - in Visual Studio you edit XAML in the right pane, and the change is reflected in the left pane as you type. That's more efficient than editing HTML or CSS in a text editor, saving, switching to browser, refreshing page. Can you explain?
Re:TypeScript included with Visual Studio 2013 Update 2 by sehr on Friday February 28, 2014 @01:01PM (#7320351)
That's entirely dependent on your workflow isn't it? I can set up a workspace within dev tools and edit HTML/CSS/JS on the fly and have the changes reflected on disk and on screen without ever losing sight of my work. Add in the networking tools (timelines, profiles etc..) and I have full featured 'IDE' that I can also browse hackernews with.
Re:TypeScript included with Visual Studio 2013 Update 2 by radicalbyte on Friday February 28, 2014 @02:03PM (#7320754)
The XAML editor in Visual Studio was broken for years. Blend, once you learn how to use it, is a much nicer tool.

In any case, unlike HTML you really don't want to be writing XAML by hand.

Re:TypeScript included with Visual Studio 2013 Update 2 by Spearchucker on Saturday March 01, 2014 @02:44PM (#7325788)
I write all my XAML by hand. Blend is a bit too cavalier for my liking, especially when building for Windows Phone.
Re:TypeScript included with Visual Studio 2013 Update 2 by tvxedoman on Friday February 28, 2014 @12:58PM (#7320337)
1) There are ST plugins if that counts 2) No, though I'm sure you could make do with snippets for now, and web components in the future.
Re:TypeScript included with Visual Studio 2013 Update 2 by iso8859-1 on Friday February 28, 2014 @07:31PM (#7322476)
web components are coming: http://www.w3.org/TR/components-intro/
Re:TypeScript included with Visual Studio 2013 Update 2 by rbanffy on Friday February 28, 2014 @09:42PM (#7322893)
> While baking TypeScript into Visual Studio isn't a certainty of its future success (e.g. Silverlight), it is a good indicator of Microsoft's commitment to the language.

It's also no indicator of continued commitment (Silverlight, WebClasses).

TypeScript is an intriguing language. It's much closer to vanilla JavaScript than CoffeeScript and that may make it feel more comfortable to JS users.

It's too soon to guess which approaches will prevail on the long run, so, one may as well hedge bets.