3 ms·
Anders Hejlsberg, Steve Lucco, and Luke Hoban: Inside TypeScript
- twp 14y agoDoes anyone have a transcript? I'd love to spend five minutes reading rather than thirty five minutes watching.
- louischatriot 14y agoHere is a summary : http://api.tldr.io/tldrs/506aee4ec8f814a2370004fa http://api.tldr.io/tldrs/506aee4ec8f814a2370004fa We are a new startup working on making content more accessible through summaries, here is the HN discussion : http://news.ycombinator.com/item?id=4602377 http://news.ycombinator.com/item?id=4602377
- louthy 14y agoThis looks very interesting indeed. I particularly like the fact that they're not trying to replace JS by using it as a compiler for a higher level language (as with Coffee Script, Dart etc.), and also I like how they've retrofitted the interfaces for the DOM, node.js, MongoDB etc. That's a nice touch. The lambda syntax from C# is also nice to see, and something I miss when writing JS. I think the solo presentation is better here: http://channel9.msdn.com/posts/Anders-Hejlsberg-Introducing-TypeScript http://channel9.msdn.com/posts/Anders-Hejlsberg-Introducing-...
- lucian1900 14y agoI don't see how CS and TS are different when it comes to compilation. They're both self-hosted and they both compile to pretty straightforward JS. Dart is different, since it has a runtime.
- louthy 14y agoThe difference is you can't use 3rd party libraries in CS or Dart unless you create some kind of wrapper for them. TS allows you to use any JS library off the bat. If you want stronger type checking the you can define an interface to the library, but it's not necessary. I think that's a much better place to be rather than create a whole new ecosystem.
- franze 14y ago>you can't use 3rd party libraries in CS yes, you can - i.e.: $('h1').hide() //javascript $('h1').hide() #coffeescript
- MatthewPhillips 14y agoBut the opposite is not always true. There are many libraries written in CoffeeScript that are difficult to use in plain JavaScript due to the use of its class syntax. You can use Underscore.js to get around this, or just write your own inheritance code, but that's obviously a big tradeoff. Of course, using TypeScript libraries in JS will likely have this same issue.
- franze 14y agothere are many libraries written in JavaScript that are difficult to use in plain JavaScript due to the use of a classy syntax, that's why even halfway decent developers care about displaying clean interfaces / API endpoints.
- MatthewPhillips 14y agoDevelopers targeting the JavaScript community will be careful to have good API endpoints, but not all to-JS programmers care about that. Batman.js (http://batmanjs.org/ http://batmanjs.org/) is one example that doesn't.
- jashkenas 14y ago> There are many libraries written in CoffeeScript that are > difficult to use in plain JavaScript due to the use of > its class syntax. No, there aren't. I can only name one, and it's a willful-on-their-part-oversight that could be easily fixed by adding a function like this: Model.extend = (child) -> child extends Model ... > You can use Underscore.js to get around this No, you can't. Underscore.js has nothing to do with inheritance. > Of course, using TypeScript libraries in JS will likely > have this same issue. Yep -- TypeScript implements a very similar inheritance function, and the potential workaround for subclassing TypeScript constructors from JavaScript should be equally easy.
- MatthewPhillips 14y agoWhat happens when one of the APIs for node or Mongo adds a function? Would we have to wait for TypeScript to add the function to the interface, otherwise there will always be compilation errors? This sounds a little delicate.
- louthy 14y agoYou could just go and change it manually, it's just a source file. It also sounds like they're open sourcing the lot...
- MatthewPhillips 14y agoYeah, I agree with that, but when I upgrade Node I also don't want to spend an hour or two fixing out-of-date interface definitions (although that would be a great way to get familiarized with Node changes).
- scanr 14y agoI suspect that if TypeScript takes off that this will probably be crowd sourced, i.e. expect to see a ts-node project on github. That said, I think they've done a reasonably good job of making it painless. Even if it weren't required, I quite like the idea of explicitly listing the 'global' dependencies a particular script has. I think it's going to make unit testing it more pleasant, i.e. because you declare the dependencies your script has, it's obvious what you need to mock out from the environment to unit test it.
- pixie_ 14y agoThe interface just adds type annotations. You can still use APIs without type annotations, and untyped variables in Typescript itself if you want. It's not 'delicate' what so ever.