rxjs/Subscription has no exported member 'Subscription'

前端 未结 4 2119
说谎
说谎 2020-12-09 09:10

I updated my angular project and all my dependencies to latest version. Without to much trouble I solved most of the dependency issues, but I\'m still stuck on RxJS. Here is

4条回答
  •  借酒劲吻你
    2020-12-09 09:38

    There is a lot of breaking changes with RxJS 6. For example, prototype methods as

    myObservable.map(data => data * 2)
    

    won't work anymore and must be replaced by

    myObservable.pipe(map(data => data * 2))
    

    All details can be found here: https://github.com/ReactiveX/rxjs/blob/master/docs_app/content/guide/v6/migration.md


    Until you have fixed all breaking changes, you can make your old code work again with rxjs-compat (https://github.com/ReactiveX/rxjs/tree/master/compat).

    This package is required to get backwards compatibility with RxJS previous to version 6. It contains the imports to add operators to Observable.prototype and creation methods to Observable.

    Type this to install it:

    npm install -s rxjs-compat
    

提交回复
热议问题