Search code examples
javascriptextjssencha-touchsencha-touch-2typescript

What is the purpose of classnames in angle brackets in definitions?


In another question here on Stack Overflow (this one) I have seen this piece of code:

Ext.define("App.view.leaders.MyViewName", {
    extend: 'App.view.basePopup',
    xtype: 'MyViewName',
    config: <Ext.form.IPanel>{
        scrollable: 'vertical',           
        items: [
            {
                 xtype: 'fieldset',
                 title: 'Add New Auto Asset',
                 instructions: '<hr class="separate" />',
                 items: [
                     <Ext.field.ISelect>{
                         xtype: 'selectfield',
                         label: 'Borrower Position',
                         store: 'BorrowerPositionSelectorStore',
                     },
                     <Ext.field.ISelect>{
                         xtype: 'selectfield',
                         label: 'Asset Type',
                         store: 'AssetTypeSelectorStore',
                     },
                     {
                         xtype: 'textfield',
                         name: '',
                         label: 'Description'
                     },
                     {
                         xtype: 'numberfield',
                         name: '',
                         label: 'Value'
                     }                               
                 ]
             }
         ]
    }
});

What is the purpose of the <Ext.form.IPanel>, <Ext.form.ISelect> tags before the components definitions? Can you point me to any documentation on that?


Solution

  • It's a TypeScript construct for generics, see: http://www.typescriptlang.org/Handbook

    To indicate the type of the object literal, they use:

    var square = <Square>{};