我正在使用一种remove
方法来发出要存储的值。但是得到一个错误
error TS2322: Type 'void' is not assignable to type 'Promise<void> | JQueryPromise<void>'.
- 如何解决这个问题?
这是我使用的示例:
https://js.devexpress.com/Demos/WidgetsGallery/Demo/DataGrid/CRUDOperations/Angular/Light/
这是我的 ts 代码:
ngOnChanges() {
if (!this.subsystems) { return; }
this.dataSource = new CustomStore({
key: 'Id',
load: (loadOptions) => this.loadData(loadOptions),
update: (key: number, values) => this.updateData(key, values),
remove: (key) => this.removeData(key) //getting error here
});
}
loadData(loadOptions) {
return new Promise((resolve, reject) => {
this.dataGrid.columns = this.columns;
resolve({ data: this.subsystems, totalCount: 10 });
});
}
removeData(key: any) {
this.deleteId.emit(key);
}