When working with API responses and dynamically sorting my view, I utilize an ngFor loop. Here's the snippet of code in question:
<agm-marker *ngFor="let httpResponses of response" [latitude]= "httpResponses.lat" [longitude]="httpResponses.lng"
[agmFitBounds]="true">
To clarify further:
...
*ngFor="let httpResponses of response" [latitude]= "httpResponses.lat" [longitude]="httpResponses.lng"
...
This setup automatically assigns the type of httpResponses as never, leading to the following errors:
error TS2339: Property 'lng' does not exist on type 'never'.
error TS2339: Property 'lat' does not exist on type 'never'.
Is it possible to define a TypeScript type for httpResponse directly in the HTML file? While the project functions correctly and displays lat and lng values from httpResponses, these errors persist. I attempted to declare a type for httpResponses in the component.ts file without success.
Any advice on this matter would be greatly appreciated.