簡體   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