When I'm trying to get responses from API, I use an ngFor for dynamically sorting my view. Here's the line of code:
<agm-marker *ngFor="let httpResponses of response" [latitude]= "httpResponses.lat" [longitude]="httpResponses.lng"
[agmFitBounds]="true">
To be more clear:
... *ngFor="let httpResponses of response" [latitude]= "httpResponses.lat" [longitude]="httpResponses.lng"
...
and it gives automatically the type of httpResponses as never. And because of that gives these errors below:
error TS2339: Property 'lng' does not exist on type 'never'.
error TS2339: Property 'lat' does not exist on type 'never'.
Can I declare any Typescript type on httpResponse in the Html file? The project works fine, I get the lat and lng values from httpResponses and display it, but however I constantly get these errors, I tried to declare type on httpResponses in component.ts file, it didn't change anything.
Thanks for any advice.
question from:
https://stackoverflow.com/questions/65918642/property-does-not-exist-on-type-never-on-ngfor-variable 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…