繁体   English   中英

如何为以下日期类型定义接口

[英]how to define interface for the following date type

我正在尝试为 this.usedPercentageFilterOptions 定义接口类型。 你知道下面的接口声明是否正确吗?

`

  interface Item {
     filterPillValue: string,
     id: string,
    label: string
}
interface Items {
    radio: Item,
    checkbox: Item
}
   public usedPercentageFilterOptions: Items[]

   this.usedPercentageFilterOptions = [
        {
          radio:  { filterPillValue: 'used%', id:'filter-used-%', label: 'Used %' },
          checkbox: [
            { filterPillValue: 'Full', id:'filter-full', label: 'Full' },
            { filterPillValue: 'Reached Critical threshold', id:'filter-critical-threshold', label: 'Reached Critical threshold' },
            { filterPillValue: 'Reached Warning threshold', id:'filter-warning-threshold', label: 'Reached Warning threshold' },
            { filterPillValue: 'Not reached threshold', id:'filter-not-reached-threshold', label: 'Not reached threshold' }
          ]
        }
    ];`

尝试这个

 export interface Cb {
       filterPillValue?: string;
       id?: string;
       label?: string
    }

export interface UsedPer {
       radio?: Cb;
       checkbox?: Cb[]
   }

希望有用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM