When retrieving data from a server, I receive an object that includes four arrays with different types of objects. I am attempting to map this data before subscribing to the observable so that I can properly utilize the classes in my frontend:
getData(){
return this.http.get(this.authUrl + 'get/auf-data').pipe(
map(({material, mat_auf, lokals, auf_analysen}) => {
material.map(material => this.materialAdapter.adapt(material));
mat_auf.map(auf => this.materialAufAdapter.adapt(auf));
lokals.map(lokal => this.lokalAdapter.adapt(lokal));
auf_analysen.map(analyse => this.aufAnalyseAdapter.adapt(analyse));
})
);
}
Although the response is an object containing four different arrays, I am encountering the following error:
Property 'material' does not exist on type 'Object' (repeated for: mat_auf, lokals, and auf_analysen)
Is there a way to specify the data types in the map function to resolve this issue?