127 points · by techbubble · 12y ago · 107 comments
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
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 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.
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.
[1] http://brackets.io [2] https://github.com/fdecampredon/brackets-typescript
[1] http://blogs.msdn.com/b/interoperability/archive/2012/10/01/...
TypeScript seems C# flange-mounted on top of JavaScript, but it's probaby the only viable alternative with good js-interop...
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 have however been annoyed at not being able to use sweet.js macros.
I was under the impression that was most if not all of typescript. What else remains? Classes?`
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.
The 'fix' was to create two line elements over the borders you wanted coloured differently.
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.
Wish they would bring prices to the level of, for example, those of Jetbrains, or made node.js extension working with Express.
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#.
- BizSpark for startups( http://www.microsoft.com/bizspark/ )
- DreamSpark for students ( https://www.dreamspark.com/ )
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.
Software cost for my side projects: $0
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).
It works simply by adding this line on the top or bottom:
/* vim:set filetype=javascript: */
You can add other options in there as well, so it's easy for others to match your indentation style for instance.There is also https://github.com/clausreinke/typescript-tools
>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.But Visual Studio's Angular support is awesome.
Netbeans as of 7.4 seems also quite nice. Just as extra info. I also like VS.
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.
Really? Who? I just don't see them or they must be really good at abstracting away this activity.
I use Sublime a lot as well on my Mac, and I don't like it as well.
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.
Chrome/Firefox dev tools.
And, if you want to use an IDE over say vim or Notepads, then Webstorm is the best.
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.
But: here's the npm https://www.npmjs.org/package/typescript
nothing stopping you from running TS on linux.
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.
[1]http://blogs.msdn.com/b/webdev/archive/2013/11/06/a-high-val... [2]http://blogs.msdn.com/b/webdev/archive/2014/02/25/announcing...
But thx, i'm going to check it out :)
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.
There you go. It's published by microsoft that way.
The source code is available under the Apache License, and if you want to get the source code:
> git clone https://git01.codeplex.com/typescript