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.
> "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.
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.
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].
[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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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?
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.
> 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.
I have the feeling that many people who dislike this have never really worked with a static typing language. I have never really worked with anything except perl, php, javascript myself until a couple of years ago when i got into game programming with Unity3D using C# and Visual Studio. That experience was enlightening, VS (+ReSharper) is like your own personal AI assistant that deeply understands your code and helps you work more efficiently. Today, while working mostly with JS again (node/angular) i sometimes feel frustrated about WebStorms inability to do the right thing because it just can't understand the code in the way it could if JS was static typed. I mean, its still far superior to a pure text editor if you are working with large codebases imo, but i somehow miss the VS experience.
My only gripe - VS is way too expensive, for my pocket at least. And you need VS to program in TS, Intellisense is that good. Sure, you can go with Express edition but then you don't have node.js extension - which kinda make the whole endeavour bit pointless (again, for me at least).
Wish they would bring prices to the level of, for example, those of Jetbrains, or made node.js extension working with Express.
Microsoft says TS is supported in Visual Studio Express 2013 for Web. That's a free download with a license that allows one to do commercial development. It won't have everything the pay versions have, but it will be more than enough for TS development.
You don't need VS for TS. Eclipse and WebStorm support it pretty well. I've evaluated Visual Studio, Eclipse and WebStorm, and Eclipse and WebStorm are better for TypeScript development, at least if you're using Node.js.
In my experience, Typescript support in IntelliJ/Webstorm has always been sketchy --- so much that I find it quite unfair that they would mention this as a feature of the paying version.
I still use it, but I often get invalid highlighting, etc.. Then I update to the latest EAP because it's supposed to fix this particular issue... and then other appear. Hmm, annoying...
I tried the VS version as well, and there the highlighting and refactoring works very well... but the editor is waaaay slower so I always give up. Funny because it works fine when working with other languages such as C#.
I tried WebStorm and found their support for TS severly lacking, IIRC it was limited to automatic compilation and basic syntax detecting. Code understanding/static type analysis was basically non-existent, e.g. it wasn't checking if argument conforms the interface described in the method's definition - you had to compile the script to find that out.
and I think there are other options if you contact someone at your local Microsoft office.
I've just started using BizSpark (for a side project with 2 friends, so the "startup" term is a bit loose), and it's a great program.
It's still way too expensive, but their goal is to let you give it a try, and if your startup is doing well you won't mind paying U$ 10.000 or whatever if you're cashing millions :)
On the other hand you do have companies that do make millions that are bailing on certain aspects of Microsoft tools and servers due licensing costs and increases. I've been involved in IT budgeting for almost two decades and the CFOs don't always sign the check just because it's an IBM/Microsoft/Oracle solution.
Ultimately, when it comes to business, one of the biggest reasons to spend money is to buy yourself time. You probably could build an entire product yourself, but if you hired a few developers at $100K/year, you could build the product way faster. If you had new systems at $3K each (instead of buying used laptops from five years ago for $99 each), development would speed up. If you spent $2K/year on a third-party software suite, you wouldn't need to build it yourself or mess around with something not quite so polished. The flip side is that if spending money on something doesn't get you any benefit then of course you shouldn't do it.
Some people see benefits, and some don't. But making comparisons to narcotics comes across as quite childish.
Cost of Visual Studio Pro + MSDN for my (small) business was £1100. This for 2 years of MSDN, and it was some deal (at the reseller's suggestion) that also came with various Windows licences too. (More Windows 7 than I imagined was likely for the price, and I think Windows XP and Windows Server 2008 R2 too.) Renewal cost is something like £900.
I wouldn't refuse something cheaper, but the price seemed fair enough as these things go. For a side project this is perhaps a little steep, and if you could realistically use something cheaper you would be silly not to, but for a business with an actual need for all this Microsoft junk this seems like reasonable value.
Stuff that costs me less than £~500/yr: printer paper.
Stuff that costs me more than £~500/yr: everything else.
Then again, just to back up your point - my last employer switched everybody from MS Office to OpenOffice to avoid the licensing fees, even though numerous internal tools (that then had to be rewritten, at a cost of several man-weeks, plus drag due to changes in workflow for the less technical staff that used them) relied on VBA, COM and OLE stuff that OpenOffice didn't support. And the place I'm currently working with doesn't install Visual Studio on the servers (each server = 6-core Core i7 with 32GB RAM, 2TB RAID1, 1TB SSD) because apparently it would be too costly to do that. So maybe once you become big enough for MS to care about things start to become rather more expensive.
I tried making the software cost for my side projects $0, and the non-Microsoft community does make it feasible, but I'm way too invested in Microsoft tools, so the productivity hit was way too steep.
I started with a stack of Grails + PostgreSQL, hosted on AWS (Elastic Beanstalk, etc.), it worked pretty nicely (I was particularly impressed with the ease of use of Elastic Beanstalk for an absolute newbie).
What I need is some free time, or a job switch (working on the 2nd part :) ).
Still, I tried most IDEs and other ways of development (Eclipse, IntelliJ, Sublime Text), and I still like Visual Studio the most. I also like Microsoft SQL Server a lot.
The Microsoft stack is certainly a lot more expensive than an equivalent stack if you have to pay for it, but having the BizSpark option, it makes a lot of sense if you come from a Microsoft background.
I've never been in the situation to make these kinds of decisions, but when you're paying tens of thousands a year per developer, sysadmin, qa, and/or ops people, a couple thousands per in software costs isn't going to break the bank.
Hmm technically you don't need an IDE to make good use of Typescript. It works very well as a standalone compiler installed using npm, and you get static type checking etc. which is really the point of Typescript IMHO --- if you don't care for static typing you might as well use JS directly.
Sure, once you've got this you might as well want good auto-completion, refactorings, etc, but this also applies to any language that's not bound to one specific IDE (C++, for example, or Java).
500 dollars for pro is extremely reasonable in my opinion, considering the value it brings. Another 150 for a personal ReSharper license and you're ready to tackle anything.
I think this is more directed at C# users. The focus of TS is to let tooling (specifically Visual Studio) do the same stuff it does in C#. They tried and failed to make VS good for JS.
VS 2013 is actually very nice for Javascript development. The only place it really falls down still is management for pure JS projects. SublimeText still beats it there for grouping JS files together just by folder instead of Visual Studio's need for clunky "solution" and "project" files.
Well, even if it's directed at C# by Microsoft, it's used by a lot of people that are not into Visual Studio or Microsoft. TypeScript is a lot more than "IDE tooling", even though proper intellisense makes it a lot of nicer to develop.
It's not like Microsoft somehow failed to make VS good for JS, it's theoretically impossible to make VS do to JS what TS can do for any IDE.
I haven't seen any Papuan, ever. Doesn't mean they don't exist.
As a side project, I'm creating a framework to build Gjs applications using TypeScript. The neat thing is that the compiler can easily create a combined JavaScript file, which when appended to a stub JS file results in a single executable for installation. The bad part is that the supplied lib.d.ts contains definitions for objects that don't exist.
I love VS for javascript. With ReSharper installed it is great. I guess maybe I answered my own question by admitting I need a JetBrains tool in there but: What tool is so great for Javascript?
I use Sublime a lot as well on my Mac, and I don't like it as well.
My sibling comments (at time of post) point out Chrome/Firefox dev tools and jshint.. Which I also use every day integrated into the same development flow. Perhaps the question is better posed as "What IDE is so great for Javascript?"
FWIW I use VS2012 for Javascript development daily. I also add in ReSharper, the wonderful Web Essentials extension (http://vswebessentials.com/) and a few other extensions I adore ('Productivity Power Tools 2012' and 'Highlight all occurrences of a selected word'). I find the result to be exceptionally good.
I agree, never had any disappointment with them. Some may think I'm exaggerating but what I see is they are contributing to Visual Studio's success more than Microsoft.
Exactly, with 1 or 2% of the market using TS the only reason to not use vanilla JS is because it is to complicated for you and you want to replicate a C# experience. That's a shame because you loose a lot of the advantages of pure JS.
And, if you want to use an IDE over say vim or Notepads, then Webstorm is the best.
Have they been working on compilation speed? About a year ago I was trying some WebGL "bindings" that had definitions for all the constants and functions, and the game I was hacking on would take 20 seconds to compile on a fairly recent Macbook Air.
It has improved in recent releases, but I think they are focusing mostly on incremental compilation via the -watch flag. My projects still take 5-7 seconds to build from scratch on my MacBook Air.
You probably know this, but just for others' information: Type inference is expensive, as it requires global information about the project. As a result, compiling one TypeScript file in a project results in the compiler recompiling all of the referenced modules and definitions to re-build up that inference information from scratch. Using the -watch flag keeps the compiler alive with that information in-tact in memory, enabling incremental recompilation.
No, it's still rather slow. We've "fixed" by doing conditional compilation (using an md5 of the files). A full compile of our project takes a few minutes.
Why is everyone so surprised that Microsoft bundled a language that Microsoft built into a piece of software that Microsoft built? This says nothing about TypeScript's future among non-.NET developers.
And this is why TypeScript is 1-2% of the market? Check out GitHub and the rest of the community outside of your workplace or whatever place you are seeing this trend, because the numbers are not showing this. Even search terms of google trends http://www.google.com/trends/explore#q=%2Fm%2F02p97%2C%20typ... shows the term JS is more popular than TypeScript. Also look at twitter and what the great developers of JS are doing; not TS. TypeScript has now tied you to an IDE on some OS (Windows) even if developing on a Unix based server. When you can simply edit JS from a half-gig box using vi if you needed, and do some awesome code. I just don't buy the idea no matter how much Microsoft throws at it, same with dart or any company backed layer over JS.
What I find funny is that this is, ironically, Microsoft's old strategy but with a positive twist. Embrace, extend, extinguish. Microsoft has already embraced Javascript - we could argue that they brought their own demise as the dominating platform when they created XMLHttpRequest. Now they're extending it.
Maybe I'm naive but at this point I don't fear Typescript extinguishing Javascript. If they send things to ECMA for standardization, they'll definitely prove a point in this direction.
ECMA Standardization means nothing with Microsoft. They will still continue the Embrace Extend Extinguish path, no matter if there is a standard or not. Just look at OOXML to see where MS does not follow their own 'standard'.
Tooling is a big boon with TypeScript: Go to Definition, Find All References, Refactor->Rename, debug your TypeScript in Visual Studio.
You're right that if you don't use the tooling, TypeScript is of lesser value. Using things like classes, lambdas, modules syntax is still there, of course, and is quite a bit nicer than JS equivalents.
Be careful with that if you use data-binding in your templates, such as Knockout.js . Visual Studio doesn't know the types of your viewmodels, so those templates are not indexed and not subject to refactoring.
Enabling rich IDE support is precisely the point of TypeScript and similar enhancements like Python 3 type annotations: Give the computer in front of you enough information to automatically do for you what you would otherwise have to do manually, freeing you up to focus on higher level problems.
And at the same time doing what Java did, abstracting away what is under the hood, so when something brakes. SOL. But this might be good, keep JS for the Pro's and TS for the Joe's?
The IDE makes TypeScript compelling, but it is useful even without the IDE. You can use the command-line compiler to check your code for errors. This is extremely useful if you have thousands of lines of code and multiple developers working on the project.
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