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

耗尽温柔 提交于 2019-12-12 23:51:50

问题


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?


回答1:


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>{};


来源:https://stackoverflow.com/questions/26364497/what-is-the-purpose-of-classnames-in-angle-brackets-in-definitions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!