代码之家  ›  专栏  ›  技术社区  ›  alphapilgrim

rxjs 6属性'of'在'typeof observate'类型上不存在

  •  17
  • alphapilgrim  · 技术社区  · 7 年前

    刚从rxjs 5/angular5移到rxjs 6/angular6 migration-guide . 好像想不出现在应该是什么样子了,谢谢你的帮助。

    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);
      }
    
    1 回复  |  直到 7 年前
        1
  •  29
  •   MichaelSolati    7 年前

    你现在可以导入 of rxjs . 所以…

    import { Observable, of } from 'rxjs';
    
    // trivial example of what im trying to replace
      isLoggedIn(): Observable<boolean> {
        return of(true);
      }
    
    推荐文章