title: Type \'Observable<{}>\' is not assignable to type in angular 2
body: <p>Observable is unable to assigend, my package.json file holds</p>
  
  <pre><code>"angular2": "2.0.0-beta.17",
  "systemjs": "0.19.24",
  "es6-promise": "^3.0.2",
  "es6-shim": "^0.35.0",
  "reflect-metadata": "0.1.2",
  "rxjs": "5.0.0-beta.6",
  "zone.js": "0.6.12"
  </code></pre>
  
  <p>Problem happens while my terminal start compiling it shows me an errormessage</p>
  
  <p>message: </p>
  
  <blockquote>
    <p>'\u001b[31mresources/assets/typescript/services/user.service.ts(25,5): \u001b[39merror TS2322: Type \'Observable&lt;{}>\' is not assignable to type \'Observable\'.\n  Type \'{}\' is not assignable to type \'User[]\'.\n    Property \'length\' is missing in type \'{}\'.' }</p>
  </blockquote>
  
  <p>in my service component this.loggedUser$ is unable to initialised by new Observable inside the constructor and it breaks the whole thing. </p>
  
  <p>This is my service component</p>
  
  <pre><code>import {Injectable} from 'angular2/core';
  import {Http,Response,Headers} from 'angular2/http';
  
  import {Observable} from 'rxjs/Observable';
  import {Observer} from 'rxjs/Observer';
  import 'rxjs/add/operator/share';
  import 'rxjs/add/operator/map';
  import {User} from '../interfaces/interfaces';
  export var API_ENDPOINT = 'http://localhost:8080/api';
  
  
  @Injectable()
  export class UserService {
  
    loggedUser$: Observable&lt;User[]&gt;; 
    private loggedUserObserver: Observer&lt;User[]&gt;;
    private loggedUserInfo:{
          users: User[]
      };
  
    constructor(private _http: Http) {
      this.loggedUser$ = new Observable(observer =&gt; this.loggedUserObserver = observer).share();
      this.loggedUserInfo = { users: [] };
    }
  
  
      getLoggedUser(){
        return this._http.get(API_ENDPOINT+'/getLoggedUser')
        .map((res:Response)=&gt;res.json())
        .subscribe(
          data =&gt; { 
          this.loggedUserInfo.users = data;
          this.loggedUserObserver.next(this.loggedUserInfo.users);
          },
          err =&gt; console.error(err),
          () =&gt; console.log(this.loggedUserInfo.users)
        );
      }
  
  
  }
  </code></pre>
  
  <p>in my interface I have</p>
  
  <pre><code>export interface User {
      id?: number,    
      name?: string,
      email?:string,
      email2?: string,
      password?: string,
      mobile?: string,
      profilePicture?:string,
      userTimeZone?: string
  }
  </code></pre>
  
  <p>if i place a type in the constructor like</p>
  
  <pre><code>this.loggedUser$ = new Observable&lt;User[]&gt;(observer =&gt; this.loggedUserObserver = observer).share();
  </code></pre>
  
  <p>then it shows me a different error on the app component, the error is not coming in the terminal its coming on the console and it is
  EXCEPTION: TypeError: _this.loggedUserObserver is undefined</p>
  
  <pre><code>import {Component,OnInit,} from 'angular2/core';
  import {Router,ROUTER_DIRECTIVES} from 'angular2/router';
  import {RouteConfig, RouteData} from 'angular2/router';
  
  import {MyProfileComponent} from './settings/my-profile.component';
  import {MyCompaniesComponent} from './company/my-companies.component';
  import {MyTasksComponent} from './tasks/my-tasks.component';
  import {UserComponent} from './user/user.component';
  
  import {Observable} from 'rxjs/Observable';
  import 'rxjs/Rx';
  import {UserService} from './services/user.service';
  import {User} from './interfaces/interfaces';
  
  
  @Component({
      selector: 'my-app',
      //templateUrl: 'appView/front.html',
      template:`{{loggedUser.name}}`,
      directives:[ROUTER_DIRECTIVES, MyProfileComponent, MyCompaniesComponent,UserComponent],
      providers: [UserService],
  
  
  })
  
  export class AppComponent{  
      loggedUser: Observable&lt;User[]&gt;;
      loggedUserInfo:User;
      constructor (private _userService: UserService){    
      }
  
  
      ngOnInit(){
          this.loggedUser = this._userService.loggedUser$;
          this._userService.getLoggedUser();
      }
  }
  </code></pre>