Live data from Hacker News

TypeScript: a language for application-scale JavaScript development

typescriptlang.org

71–80 of 316 posts

Re: TypeScript: a language for application-scale JavaScript development

#71
post #57

All 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…

Javascript is dreadfull , and its flaws are counter productive and intolerable. It has good things like closures and first class functions , and that's it. Most of js developpers hate javascript , but are forced to work with it. So they dont care what they use as client language provided it gets the job done. few people cares about Javascript. most of the devs hate it. But the browser as dev plateform is a fact.

> Most of js developpers hate javascript

I don't know of any JS developers that hate JS. I know a lot that hate some browser implementations of JS though.

Re: TypeScript: a language for application-scale JavaScript development

#72
post #26

This looks nice. I love the fact that there's no runtime that needs to be included or any overhead when the compiled JS runs. It'd be 100% more useful if it was more aware of nullable types -- as it is, it appears that null * 7 compiles without any error messages. If they add a "nullable number" type distinct from "number", I'll be a lot more likely to use it. It also appears that some other things compile that perha…

`7[2]` is valid Javascript, so it is also valid TypeScript (fetching the '2' member of the `7` object). Detecting null expressions at compile time might help. There are "nullable" types, but afaik only in signatures: foo(x?) { alert(x); } If `x` is not passed in, it will be `undefined`.

"wingspan" * 7 is also gramatically correct JavaScript, but evaluates to NaN and almost certainly isn't what you want in your JS program, which is why TypeScript prints a type error (well, warning) if you try to compile it.

Having optional variables is similar, but not the same as nullable types, especially when the compiler can't enforce non-nullable-ness. All JS devs are familiar with the annoying error "'null' is not an object" (and anyone who's programmed in a language like Haskell, OCaml, or F# knows the value of sophisticated compile-type type checking).

Re: TypeScript: a language for application-scale JavaScript development

#73
post #32

Earlier quoted context omitted.

You lost me at "M$". I'd like to think that HN's level of discussion is above that.

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.

Re: TypeScript: a language for application-scale JavaScript development

#74

What about debugging? Thats my biggest problem with coffeescript How do they map errors thrown in the browser, to TypeScript code? If this has things like classes and such, the relationship isnt always going to be 1:1 and debugging can become a nightmare. Part of what makes javascript so great is how easy it is to debug. All these "superset" languages that compile to javascript fail hard @ debug support usually

Debugging would be helped greatly if they supported source maps (http://www.html5rocks.com/en/tutorials/developertools/source...).

Re: TypeScript: a language for application-scale JavaScript development

#75
post #37

Earlier 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

Could you please explain why it would output that?

Re: TypeScript: a language for application-scale JavaScript development

#76

Awesome, great to see this finally released. I'm a dev in FUSE Labs ( http://fuse.microsoft.com ) and we've been dogfooding TypeScript for a while now. I'd be happy to answer any questions about using TypeScript vs vanilla JS, converting a large codebase, etc.

This is great to hear. I have only just started reading up on TypeScript. But I would love to know if there will be support for a decimal type. I have been following Google's work on Dart and it doesn't look like they will be implementing it last I checked. Such a feature would be a great differentiator.

A team member could comment better than I, but unless TypeScript adds some kind of operator overloading, supporting a new type would be difficult since it compiles to normal JavaScript. Even then, creating a performance decimal type without native code support might be difficult.

Re: TypeScript: a language for application-scale JavaScript development

#77
post #9
post #4

Say 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…

Also cool: in addition to the expected Visual Studio support, they've also provided support for Sublime Text, Emacs, and Vim. http://blogs.msdn.com/b/interoperability/archive/2012/10/01/...

Sourcing typescript.vim throws errors: http://pastebin.com/raw.php?i=HHDJDG7X

Re: TypeScript: a language for application-scale JavaScript development

#78

On a tangent, does anyone know anything about the in-browser editor they are using for the playground? It seems really slick. The javascript references something called "monaco" and the directories are all prefixed with "vs". The code is hosted on their demo site; /Script/vs/editor/editor.main.js appears to be the main js file and has this notice: /*! © Microsoft. All rights reserved. This library is supported for us…

I believe the monaco editor is already being used in Azure Websites and possibly the TFS preview. I wouldn't be surprised if more information about it would be released soon, they are also a major dogfooder of TypeScript.

Re: TypeScript: a language for application-scale JavaScript development

#79
post #37

Earlier 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);

It's actually even shorter: names = people.map((p) -> p.name)

I wish Typescript would add "implied return of last statement" to the short function syntax! I love that feature in Erlang.

Re: TypeScript: a language for application-scale JavaScript development

#80

All 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]
Post reply on HN