Upon completing the development of an app that mirrors an existing Angular 2 (non-cli) application, I am encountering errors in several of my files now that the project has been transitioned to Angular-CLI. I am puzzled as to why these errors are arising in the CLI version but were absent in the previous iteration. Could this be a consequence of Webpack integration? Or perhaps a difference in how Typescript is handled between the two builds? It's worth noting that the original app utilized SystemJS while the Angular-CLI version employs Webpack. By "building out" the app, I mean that I meticulously recreated all the components, directives, modules, and routes from the original app in this new version. The common error message that recurs across multiple files is as follows:
Error: Return type of public method from exported class has or is using name 'ErrorObservable' from external module but cannot be named
Here's an excerpt from a file that triggers this error:
import { Observable } from 'rxjs/Observable';
import { Http, Response } from '@angular/http';
import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/throw';
@Injectable()
export class StreamCountsService {
private _url: string = "https://api.somesite.com"
constructor(private _http: Http) {}
getCount() {
return this._http.get(this._url)
.map((response:Response) => response.json())
.catch(this._errorsHandler);
}
_errorsHandler(error: Response) {
console.error(error);
return Observable.throw(error || "Server Error");
}
}
My Environment: MacBook Air, OS X El Capitan
Angular-CLI Version Currently using Angular-CLI version 1.0.0-beta.22-1
The complete error trace is as follows (slightly redacted for privacy reasons):
Error details...
Below are the dependencies listed in my package.json file:
{
"name": "cli-ark",
"version": "0.0.1",
"license": "MIT",
...
detailed package.json contents here
...
}