I want to overwrite sortingDataAccessor
to make sorting my table work with all of its columns. However, I keep running into error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Job'
.
Here is how I am trying to overwrite the sortingDataAccessor
:
this.dataSource.sortingDataAccessor = (item, property) => {
switch (property) {
case "date":
return item.jobDate;
default:
return item[property];
}
};
The error is being thrown here:
item[property]
What am I doing wrong and how can I properly overwrite this function without getting this error?