[英]Is there a type 'Node' on JavaScript / 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.