I have been able to get data from a swagger endpoint, it displays on the console but throws an error whenever I try to loop through it and display its properties on the template view.
I get an error as shown below in the red area:

in the component.ts the data is passed through a service and console.logged:
export class CompanyDialogComponent implements OnInit{
taskpilot!: IGetTaskPilot[];
constructor( private domainService: DomainService) {}
ngOnInit(): void {
this.domainService.getTaskPilot().subscribe({
next:(response) => {
this.taskpilot = response;
console.log(response);
return response;
},
});
}
}
on the template:
<div *ngFor="let taskpilot of taskpilot">
<div class="flex items-center px-5 my-3">
<!-- <img [src]="mock_companies.img" width="20px" /> -->
<span class="ml-4">
<h2>{{ taskpilot.companies }}</h2>
</span>
</div>
</div>