I just spotted TypeScript (http://www.typescriptlang.org/), and it looks promising. Has anybody had a chance to play around with it yet? I want to understand if it would be possible to produce a TypeScript declaration file to declare all the types from the Ext JS and Sencha Touch frameworks. I'd love to have better static analysis and tool support for my Sencha development work.
The question is whether any thought has been given to providing a declarations file ... for those that don't find it "ugly", and that perhaps like correct code and productivity.
I was thinking about looking at the existing declaration files that the TypeScript team already produced for JQuery, JQuery UI, node.js, etc. to figure out exactly what kind of metadata it needs and then seeing if it's possible to create declarations for some Sencha classes manually. Then, once I have an idea if it's possible and, if so, what exactly the declarations look like, I could try to automate the construction of the declaration file(s) from the Sencha class system. Even if you could manually create declarations for the entire framework, you wouldn't want to curate them manually; you would want them to be updated automatically whenever the underlying framework changes. Of course, it would be great if Sencha could provide the necessary type declarations. I'm sure the creators and maintainers of the framework understand it better than I ever will.
The question is whether any thought has been given to providing a declarations file ... for those that don't find it "ugly", and that perhaps like correct code and productivity.
Or you can write correct and productive JavaScript without the need of any compiler like coffeescript or typescript.
For something like Ext, I don't think it makes tons of sense. Ext provides a class system and takes care of most cross browser issues. It provides a ton of functionality that Js doesn't do on its own. As far as code analysis is concerned, Sencha recently released an eclipse plugin that brings plenty of code intelligence to the table. I think TypeScript would add a layer of complexity to Ext without bringing any benefit that it doesn't already have. TypeScript looks cool and I think it would be great to use if you are working with Js on its own, but not with something like Ext.
I think it would be worth it just for the intellisense...
FWIW - I was having a play with this today - extracting the data from the documentation - and I've got that into a C# object so I can play with it..
For now - as an example - I can generate code like this (this is pretty much straight from reading the jsduck json output) :
For something like Ext, I don't think it makes tons of sense. Ext provides a class system and takes care of most cross browser issues. It provides a ton of functionality that Js doesn't do on its own. As far as code analysis is concerned, Sencha recently released an eclipse plugin that brings plenty of code intelligence to the table. I think TypeScript would add a layer of complexity to Ext without bringing any benefit that it doesn't already have. TypeScript looks cool and I think it would be great to use if you are working with Js on its own, but not with something like Ext.
I am really happy that ccg brought this up, however, I 100% agree with you, Tim.
I recently blogged about TypeScript and I am definitely in agreement with Microsoft's rationale behind the initiative. This was before I landed a gig as an iOS, Android and Sench Touch mobile application architect as of two weeks ago. I'm already cooking up a blog post about my thoughts on Sencha Touch and the Sencha Class System and I've got a handful of other blog post ideas itching to be typed out, lol.
With that said, I can absolutely foresee some additional syntactic sugar added on top of the Sencha Class System once TC39 is finally released and ES6 becomes a reality. I can't *wait* for that day to arrive! :-)
Or you can write correct and productive JavaScript without the need of any compiler like coffeescript or typescript.
I don't believe TypeScript is "ugly" like CoffeeScript is because it's a Superset of Javascript, as in All Aditional Language Features Are Option since you can code in regular javascript and not have to use the compiler, but gain the benefits of the type inference combined with visual studio tools.
Also, I can't write "correct javascript" when I'm using Ext because whenever I use this.callParent() it throws an error: "Uncaught TypeError: Illegal access to a strict mode caller function.ext-all.js:21"
I do agree however that a lot of those "ugly" optional features of TypeScript are already solved when using Ext such as module-like class definitions, callParent(), constructors, as well as a type/class system with inheritance.
Even though there is an Eclipse plugin for Ext, I don't see it being an apealing option for windows developers to have to use both visual studio and eclipse to properly debug things at development-time....
Since the Ext docs are generated from the source, I don't think it would be difficult to generate .d.ts definitions as well out of them.
Since you can basically drop in any Javascript code "as is" into TypeScript, I don't see how you can compare it to being "ugly" like CoffeeScript as there is no need to port code over to a different compiler, I see it as an excellent way to gain tons of nice productivity tools for javascript in the visual studio ecosystem. Since Ext already has a nice class system, I don't see a reason to use many of the "ugly" parts.