After spending the last 2 years working on Angular, I am now encountering an issue with a new interface for the first time. The specific error message is as follows:
Type 'MatTableDataSource<Tasks[]>' is missing the following properties from type 'Tasks[][]': length, pop, push, concat, and 24 more.ts(2740)
I would greatly appreciate any assistance in resolving this minor issue. Below is the code snippet in question:
export interface Tasks {
id: string;
title: string;
description: string;
assignedTo: Array<Team>,
status: string;
}
Service
getTasks(): Observable<Tasks[]> {
return this.http.get<Tasks[]>(`${environment.API_URL}tasks`).pipe(
map(data => {
return data;
})
)
}
Component File
getTasks() {
this.taskService.getTasks().subscribe(response => {
console.log(response)
if (this.tasks) {
this.dataSource.data = new MatTableDataSource<Tasks[]>(response)
}
console.log(this.tasks)
})
}
https://i.sstatic.net/Oa9Up.png
Any tips or solutions would be highly appreciated!