0
votes

Hello I have been searching for an answer about this error I'm getting. I cannot seem to figure this out, I have read a lot of posts similar but none the same. I just updated from angular 4/ rxjs "5.0.0-beta.12" to angular 7 /rxjs 6.3.3 I have been running into this error

ERROR TypeError: (intermediate value).share is not a function at new ProgressBarService (progressbar.service.ts:21) at _createClass (core.js:19827) at _createProviderInstance (core.js:19801) at resolveNgModuleDep (core.js:19765) at _createClass (core.js:19837) at createProviderInstance (core.js:19801) at resolveNgModuleDep (core.js:19765) at NgModuleRef.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:20473) at resolveDep (core.js:20844) at createClass (core.js:20720)

which i have found to add import 'rxjs/add/operator/share'; and add the following code:

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/debounceTime';  // added method
import 'rxjs/add/operator/map';           // added method

but neither seem to work. does anyone have sugestions?

2

2 Answers

2
votes

RxJS v6 has new import statements (see section 2 in the link).

import { Observable } from 'rxjs';
import { map, debounceTime, share } from 'rxjs/operators';  // added method
0
votes

the import style on rxjs 6 is different. Besides OP's error is coming from share function.

your imports should be (including share function)

import { Observable } from 'rxjs';
import { map, share, debounceTime } from 'rxjs/operators';