I am currently running a demo app and I am new to Angular. Below is my category list component.
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { AngularGridInstance, Column, GridOption, GraphqlService, GraphqlResult, Filters, Formatters, OnEventArgs, FieldType } from 'angular-slickgrid';
import { CategoryDataService } from 'src/app/core/services/category-data.service';
import { PageService } from 'src/app/core/services/page.service';
const GRAPHQL_QUERY_DATASET_NAME = 'categories';
@Component({
templateUrl: './category-list.component.html',
styleUrls: ['./category-list.component.css']
})
export class CategoryListComponent implements OnInit {
angularGrid: AngularGridInstance;
columnDefinitions: Column[];
gridOptions: GridOption;
dataset = [];
constructor(private dataService: CategoryDataService, private router: Router, private pageService: PageService) {
}
ngOnInit(): void {
this.columnDefinitions = [
...removed
];
this.gridOptions = {
backendServiceApi: {
service: new GraphqlService(),
options: {
columnDefinitions: this.columnDefinitions,
datasetName: GRAPHQL_QUERY_DATASET_NAME
},
process: (query) => this.getCategories(),
}
};;
}
getCategories(): Observable<GraphqlResult> {
var args = this.pageService.getPageArgs(this.angularGrid);
return this.dataService.searchCategories(args)
.pipe(map(
page => {
var result: GraphqlResult = {
data: {
[GRAPHQL_QUERY_DATASET_NAME]: {
nodes: page.items, ---here i am getting error
pageInfo: {
hasNextPage: page.hasNextPage
},
totalCount: page.totalCount
}
}
};
return result;
}));
}
}
The demo project was functioning properly before. However, after updating to the latest version of Slick Grid, I encountered the following error. It displays 'not type any' error. Could someone please guide me on how to convert a generic class to any type? Thank you.
https://i.sstatic.net/gCeDL.png
Here is the interface for Pagination.
export interface IPagedList<T> {
pageIndex: number;
.... removed
items: T[];
}
Error: Type of computed property's value is '{ nodes: IProduct[]; pageInfo: { hasNextPage: boolean; }; totalCount: number; }', which is not assignable to type 'any[]'. Object literal may only specify known properties, and 'nodes' does not exist in type 'any[]'.