1. #1
    Sencha Premium Member
    Join Date
    Apr 2011
    Location
    Chicago, IL
    Posts
    65
    Vote Rating
    11
    ccg will become famous soon enough

      5  

    Default TypeScript

    TypeScript


    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.

    Thanks!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,118
    Vote Rating
    855
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Just another thing to make things ugly

    [EDIT]
    Regardless of how many times I say this comment was obviously a personal comment, it's still personal. If you haven't talked to me or followed me on Twitter or anything, I'm anal about my code and the syntax that TypeScript (even ES6) is ugly.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    1
    Vote Rating
    5
    jdecicco is on a distinguished road

      5  

    Default


    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.

  4. #4
    Sencha Premium Member
    Join Date
    Apr 2011
    Location
    Chicago, IL
    Posts
    65
    Vote Rating
    11
    ccg will become famous soon enough

      0  

    Default TypeScript declaration file for Sencha

    TypeScript declaration file for Sencha


    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.

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,118
    Vote Rating
    855
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Quote Originally Posted by jdecicco View Post
    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.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #6
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    537
    Vote Rating
    71
    Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough

      2  

    Default


    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.

  7. #7
    Sencha Premium Member
    Join Date
    Sep 2012
    Posts
    91
    Vote Rating
    8
    zz9pa is on a distinguished road

      1  

    Default


    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) :

    interface Ext_toolbar_Paging : Ext_toolbar_Toolbar {
    // Cfg
    afterPageText : String;
    beforePageText : String;
    displayInfo : Boolean;
    displayMsg : String;
    emptyMsg : String;
    firstText : String;
    inputItemWidth : Number;
    lastText : String;
    nextText : String;
    prependButtons : Boolean;
    prevText : String;
    refreshText : String;
    store : Ext.data.Store;
    // Properties
    // Events
    beforechange(_this:Ext.toolbar.Paging,page:Number,eOpts:Object) : void;
    change(_this:Ext.toolbar.Paging,pageData:Object,eOpts:Object) : void;
    // Methods
    bind(store:Ext.data.Store) : void;
    doRefresh() : void;
    getStoreListeners() : Object;
    initComponent() : void;
    moveFirst() : void;
    moveLast() : void;
    moveNext() : void;
    movePrevious() : void;
    onDestroy() : void;
    unbind(store:Ext.data.Store) : void;
    }


    So - if someone knows the structure of the .d.ts file I should generate - I can have a go at doing it...

  8. #8
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    537
    Vote Rating
    71
    Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough

      0  

    Default


    While I have never used Ext's eclipse plugin as it is bundled with Sencha Complete, I would think it would be much more intelligent for use with Ext than a third party language's intellisense. I would certainly support a person's decision to try to add it though.

  9. #9
    Sencha User
    Join Date
    Oct 2012
    Posts
    1
    Vote Rating
    3
    JavascriptIsMagic is on a distinguished road

      3  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    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.

  10. #10
    Sencha Premium Member
    Join Date
    Apr 2011
    Location
    Chicago, IL
    Posts
    65
    Vote Rating
    11
    ccg will become famous soon enough

      0  

    Default TypeScript support in JetBrains' IDEs like IntelliJ and WebStorm

    TypeScript support in JetBrains' IDEs like IntelliJ and WebStorm


    If anybody else here is interested in TypeScript support in JetBrains' IDEs (IntelliJ, WebStorm, etc.), you can vote for it here:

    http://youtrack.jetbrains.com/issue/WI-13714