I was previously working with Angular 2/4 without any issues. However, after upgrading to Angular 7, I started encountering this error consistently across my application. What could have caused this sudden problem?
Type 'Observable<Observable<Object[]>>' is not assignable to type 'Observable<Object[]>'
Type 'Observable<Object>' is not assignable to type 'Observable<object[]>'.
Type 'Object' is not assignable to type 'object[]'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Property 'includes' is missing in type 'Object'.
Even when trying to use the 'any' type, the error persists.
Here is the section of code that is affected:
getProfiles(): Observable<any[]> {
const _url: string = this._serviceUrl + 'api/GetUserProfiles/';
return this._http.get(_url)
.catch(this.handleError);
}
Method where this issue arises:
this._exceptionService.getProfiles().subscribe(data => {
this.data = data[0];
}
Snippet from package.json file:
"@angular/animations": "^7.0.0",
"@angular/cdk": "^7.0.0",
"@angular/common": "^7.0.0",
"@angular/compiler": "^7.0.0",
"@angular/core": "^7.0.0",
"@angular/forms": "^7.0.0",
"@angular/http": "^7.0.0",
"@angular/material": "^7.0.0",
"@angular/platform-browser": "^7.0.0",
"@angular/platform-browser-dynamic": "^7.0.0",
"@angular/router": "^7.0.0",