I am a newbie with Angular 8.
I would like to pass an array of interfaces to a sort function, and I would like to pass interface attributes as parameters.
For now I have tried this way:
sortBy<T, K keyof T>(field: K, arr: T[], mode: 'Asc' | 'Desc'): T[] {
const res = arr.sort((x, y) => x[field].localCompare(y[field], undefined, { sesitivity: 'base' }));
return mode === 'Asc'
? res
: res.reverse();
}
But I am noticing that the editor (VSCode) is reporting to me some inaccuracies, in particular:
I can't decipher these comments. What should I do to optimize my function?