In the hero.service.ts constructor:
@Injectable()
export class HeroService {
private _heroObserver: Observer<Hero>;
hero$: Observable<Hero>;
public errorMessage: string;
constructor (private http: Http) {
this.hero$ = new Observable((observer:any) => this._heroObserver = observer).share(); // line 29
}
After compiling, an error occurs:
[0] hero.service.ts(29,9): error TS2322: Type 'Observable<{}>' is
not assignable to type 'Observable<Hero>'.
[0] Type '{}' is not assignable to type 'Hero'.
[0] Property '_id' is missing in type '{}'.
The Type '{}' is referencing an empty object. To fix this issue:
PS: This error is occurring on beta-16.