21

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);
  }
alphapilgrim
  • 3,761
  • 8
  • 29
  • 58

2 Answers2

34

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);
  }
MichaelSolati
  • 2,847
  • 1
  • 17
  • 29
7

If you are using Angular 6 /7 or 9

import { of } from 'rxjs';

And then instead of calling

Observable.of(res);

just use

of(res);