I'm trying to display json data in my angular material table but I have a problem I don't understand.
error: The type argument '{type: string; weight: number; }' is not assignable to the type parameter 'never'.
What does type never mean ?
ts.file
export class TableComponent implements OnInit {
ELEMENT_DATA: Itype[] = [];
displayedColumns: string[] = ['dechets.type', 'dechets.weight'];
dataSource = new MatTableDataSource<any>(this.ELEMENT_DATA);
constructor(private typeService: TypeService) { }
ngOnInit() {
this.getAllDetails();
}
public getAllDetails() {
let resp = this.typeService.getAllType();
resp.subscribe(resp => {
this.dataSource.data = resp.reduce((acc, item) => {
acc.push(...item.dechets); // probleme is here
return acc;
}, []);
});
}
interface
export interface Itype {
type_collecte: string;
dechets:
{
type: string;
weight: number
}[];
code_traitement: string;
annee: number;
mois: number;
}