簡體   English   中英

DevExpress Typescript 字段類型 ts(2345)

[英]DevExpress Typescript Field Type ts(2345)

我正在嘗試添加一些字段來創建日期分組,但出現類型錯誤。

let dateGroups: {
    area: string;
    dataField: string;
    dataType: string;
    groupInterval: string;
}[]
Argument of type '{ area: string; dataField: string; dataType: string; groupInterval: string; }' is not assignable to parameter of type 'PivotGridDataSourceField'.
  Types of property 'area' are incompatible.
    Type 'string' is not assignable to type '"column" | "data" | "filter" | "row" | undefined'.ts(2345)

這是我的代碼:

let dateRollupFields = this.pibotGridSource.fields();
const createdAtIndex = dateRollupFields.map(o => o.caption).indexOf("Created At");
let dateGroups = [{
        area: 'column',
        dataField: 'created_at_date',
        dataType: 'date',
        groupInterval: 'month'
      }, {
        area: 'column',
        dataField: 'created_at_date',
        dataType: 'date',
        groupInterval: 'year'
      }]

dateRollupFields.splice(createdAtIndex + 1, 0, dateGroups[0]);

PivotGridDataSourceField注釋為dateGroups的數組。

let dateGroups: PivotGridDataSourceField[] = [{

您應該能夠從數據透視網格導入類型。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM