I am using every function to check if a particular checkbox in the grid is checked or not, I am using angular 2 and below is my code to do that:
// Typescript code
this.toggle = this.contactlist.every(item => item.checked);
// JS output is
this.toggle = this.contactlist.every(function(item) {
return item.checked;
});
Now I want to include more code inside that every function so I tried this:
this.toggle = this.contactlist.every(item => {
item.checked;
console.log('Item:', item)
});
// In Webpack it gives me this error
Argument of type '(item: any) => void' is not assignable to parameter of type '(value: any, index: number, array: any[]) => boolean'.
Type 'void' is not assignable to type 'boolean'.
How I can solve it?