I have the following HttpClient.post call which return an array of Objects.
import { map } from 'rxjs/operators/map';
public getArray(profileId: number): Observable<any> {
return this.http.post("/api/url", postObject, HttpSettings.GetDefaultHttpRequestOptions())
.pipe(map(data => {
console.log(data); // logs (2) [{…}, {…}]
return data;
}));
}
I need to Instantiate an Array of objects. I can't just type assert because I need the Thing constructor to parse some json and other.
Essentially what I want to do is:
.pipe(map(data => {
console.log(data); // logs (2) [{…}, {…}]
return data.map(v => new Thing(v));
}));
However I can't (to my knowledge) because data is of Type ArrayBuffer and is not iterable. How can I achieve this?