属性不存在类型,类型脚本angularjs

时间:2018-02-11 12:35:08

标签: typescript properties

我收到此类错误:

文件1:app-config.ts

import * as i18next from 'i18next';

export default [
    {
        label: 'config:leftnav.Dashboard',
        icon: 'svg-icon-nav-dashboard',
        children: [
            {
                label: 'config:leftnav.Overview',
                sref: 'global.nav.overview'
            }, {
                label: 'config:leftnav.Performance',
                sref: 'global.nav.dashboard'

            }, {
                label: 'config:leftnav.ClusterView',
                sref: 'global.nav.clusterDashboard'
            }
        ] 
    },

文件2:leftnav-config.ts

import leftNavConfig from './leftnav-config';

for(var i=0;i<=leftNavConfig.length-1;i++){
  leftNavConfig[i].label= i18next.t(leftNavConfig[i].label);
  for( var j=0;j<=leftNavConfig[i].**children**.length-1;j++) {
    leftNavConfig[i].**children**[j].label=i18next.t(leftNavConfig[i].**children**[j].label);
  } 
}

我收到以下错误

Property 'children' does not exist on type '{ label: string; icon: string; children: { label: string; sref: string; }[]; } | { label: string;...'.
Property 'children' does not exist on type '{ label: string; icon: string; sref: string; }'.

0 个答案:

没有答案