Arrays 带有嵌套数组的typescript类-创建模拟数组时出错

Arrays 带有嵌套数组的typescript类-创建模拟数组时出错,arrays,angular,typescript,typescript2.0,Arrays,Angular,Typescript,Typescript2.0,我试图在Typescript 2.3.3(Angular 4)中定义对象的模拟数组,但我遇到了错误 我的主数据类在名为invoice config.ts的文件中定义: import {CustomerVariant} from './customer-variant' export class InvoiceConfig { c

我试图在Typescript 2.3.3(Angular 4)中定义对象的模拟数组,但我遇到了错误

我的主数据类在名为
invoice config.ts
的文件中定义:

import {CustomerVariant} from './customer-variant'                              

export class InvoiceConfig {                                                    
  customerName: string;                                                         
  customerVariants: CustomerVariant[];                                          
}
export class CustomerVariant {                                                                                                         
  id: string;                                                                  
  templates: string[];                                                 
} 
这些是
客户变量.ts
的内容:

import {CustomerVariant} from './customer-variant'                              

export class InvoiceConfig {                                                    
  customerName: string;                                                         
  customerVariants: CustomerVariant[];                                          
}
export class CustomerVariant {                                                                                                         
  id: string;                                                                  
  templates: string[];                                                 
} 
现在,我想在名为
mock invoice configs.ts
的文件中创建一个包含
invoice config
对象的模拟数组。我已尝试使用此文件:

import { InvoiceConfig } from './invoice-config';                               

export const INVOICE_CONFIGS: InvoiceConfig[] = [                               

  {                                                                             
    customerName: "CUSTOMER1",                                                  
    customerVariants = [                                                        
      {                                                                                                     
        id: "A9",                                                       
        templates = [                                                  
          "default"                                                             
        ]                                                                       
      }                                                                         
    ]                                                                           
  },                                                                            

  {                                                                             
    customerName: "CUSTOMER2",                                                        
    customerVariants = [                                                        
      {                                                                                                            
        id: "A3",                                                       
        templates = [                                                  
          "default"                                                             
        ]                                                                       
      }                                                                         
    ]                                                                           
  }
]     
但它会产生错误:

ERROR in /home/myuser/client-app/src/app/mock-invoice-configs.ts (7,5): Cannot find name 'customerVariants'.

ERROR in /home/myuser/client-app/src/app/mock-invoice-configs.ts (7,22): '=' can only be used in an object literal property inside a destructuring assignment.

ERROR in /home/myuser/client-app/src/app/mock-invoice-configs.ts (19,5): Cannot find name 'customerVariants'.

ERROR in /home/myuser/client-app/src/app/mock-invoice-configs.ts (19,22): '=' can only be used in an object literal property inside a destructuring assignment.
我不明白为什么它找不到“customerVariants”(是InvoiceConfig类的属性之一?)。
如何定义嵌套对象(CustomerVariant)数组而不使用“=”?

您需要将
=
替换为
例如


您需要将
=
替换为
例如


用:代替它?就像你对任何其他财产一样。。因为它和其他任何财产一样。用法:代替它?就像你对任何其他财产一样。。因为它和其他任何财产一样。