rxjs 6 Property 'of' does not exist on type 'typeof Observable'

alphapilgrim picture alphapilgrim · Jun 8, 2018 · Viewed 16.5k times · Source

Just moved from rxjs 5/angular 5 to rxjs 6/ angular 6, went through this migration-guide. Can't seem to figure out what it should be now, any help appreciated.

import { Observable, of } from 'rxjs';
[ts] 'of' is declared but its value is never read.

// trivial example of what im trying to replace
  isLoggedIn(): Observable<boolean> {
    return Observable.of(true);
  }

Answer

MichaelSolati picture MichaelSolati · Jun 8, 2018

You can now just import of from rxjs. So....

import { Observable, of } from 'rxjs';

// trivial example of what im trying to replace
  isLoggedIn(): Observable<boolean> {
    return of(true);
  }