I've written a lot of JavaScript, including large-scale projects, and never once have thought, "Gee, I wish I had type checking." Haven't we come to a consensus that types are more trouble than they're worth? They hurt clarity and catch few bugs.
TypeScript: a language for application-scale JavaScript development
81–90 of 316 posts
Re: TypeScript: a language for application-scale JavaScript development
#82Earlier quoted context omitted.
I like the shortened function form. I played around with CS for a while before going back to JS, but I do miss being able to do something like: var names = people.map((p) -> return p.name); (or something along those lines). Funnily enough, it reminds me of C#'s LINQ: var names = people.Select(p => p.name);
I've written a LINQ style library for TypeScript that allows you to write something like this: from([1,2,3]).select(n => n * n).where(n >=2).toArray() which outputs [4, 9] Hoping to open source it soon. Edit: typo, n * 2 should have been n * n, sorry for the confusion
_.chain([1,2,3]).map(n => n * n).filter(n => n >= 2).value()Re: TypeScript: a language for application-scale JavaScript development
#83- It's a superset of JavaScript. So there is no porting effort needed. (With CoffeeScript, you do not need to port if you don't want to.)
- compile-time type checking, like type erasure in Java's generics.
- module support at the language level. It's very thin. It does not give your AMD or CommonJS module, but you can easily hack around it.
- class and inheritance support at the language level. The implementation is very similar to CoffeeScript's.
Re: TypeScript: a language for application-scale JavaScript development
#84This seems similar to the type checking and optimization done by Google Closure Compiler?
Another huge advantage is that the typescript parser & compiler is written in Javascript. Closure's jscomp is Java, which decreases backend portability somewhat.
Re: TypeScript: a language for application-scale JavaScript development
#85Re: TypeScript: a language for application-scale JavaScript development
#86All of these compile-to-JS efforts are great, and as much as I love things like CoffeeScript I have to say I definitely worry about language fragmentation. JavaScript is full of flaws, but its monopoly in the browser space has brought about one intriguing and welcome side-effect: a VERY efficient market for both employers and employees. It's easy to overlook how important this common denominator has been for everyone…
I think you were referring to the JavaScript syntax when you said JavaScript is full of flaws, because IMHO the language itself - except the syntax component - is actually very good. Someone on Quora said[1] it very well: JavaScript is a wonderful language, deep down: It's Lisp-y, yet imperative. Its lack of support for threads has turned out to be a strength on the server side. And recent implementations have made i…
Re: TypeScript: a language for application-scale JavaScript development
#87$ t command not found clearly they could have named the compiler just 't' instead of the overly verbose 'tsc'. all those extra characters!!
Re: TypeScript: a language for application-scale JavaScript development
#88Earlier quoted context omitted.
Nonetheless, interesting disclaimer text spotted there. Raises a good question... would that text be there because somebody in the industry analyzes your code?
Are we reading the same thing? Code is not sent to Microsoft.
Having that disclaimer makes them safe in case someone might notice that insert IDE / online editor here does that and rings the bell.
Re: TypeScript: a language for application-scale JavaScript development
#89Say what you want about whether this is a good idea or not, it is clear at least part of MS is really serious about open source. * TypeScript is under the Apache 2.0 license [1] * Source is available via git on Codeplex [2] * Installation is as easy as npm install -g typescript [3] Extra bonus coolness: They've provided an online playground like jsfiddle! [4]. [1] http://typescript.codeplex.com/license [2] http://typ…
Re: TypeScript: a language for application-scale JavaScript development
#90All of these compile-to-JS efforts are great, and as much as I love things like CoffeeScript I have to say I definitely worry about language fragmentation. JavaScript is full of flaws, but its monopoly in the browser space has brought about one intriguing and welcome side-effect: a VERY efficient market for both employers and employees. It's easy to overlook how important this common denominator has been for everyone…
[deleted]