Reputation: 322
I want to create a new Angular 6 App with AngularFire 2. Although I followed the tutorial, I get a version error.
AngularFire2 Setup Tutorial: https://github.com/angular/angularfire2/blob/master/docs/install-and-setup.md
Even though I only tried to use an Observable as seen in the tutorial I get the following error:
ERROR in node_modules/angularfire2/angularfire2.d.ts(3,10): error TS2305: Module '"/Users/tarek/Documents/Development/web_app/apphoven-web/node_modules/rxjs/Subscription"' has no exported member 'Subscription'.
node_modules/angularfire2/firestore/collection/changes.d.ts(3,10): error TS2305: Module '"/Users/tarek/Documents/Development/web_app/apphoven-web/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/angularfire2/firestore/collection/collection.d.ts(3,10): error TS2305: Module '"/Users/tarek/Documents/Development/web_app/apphoven-web/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/angularfire2/firestore/document/document.d.ts(3,10): error TS2305: Module '"/Users/tarek/Documents/Development/web_app/apphoven-web/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/angularfire2/firestore/firestore.d.ts(3,10): error TS2305: Module '"/Users/tarek/Documents/Development/web_app/apphoven-web/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/angularfire2/firestore/interfaces.d.ts(1,10): error TS2305: Module '"/Users/tarek/Documents/Development/web_app/apphoven-web/node_modules/rxjs/Subscriber"' has no exported member 'Subscriber'.
node_modules/angularfire2/firestore/observable/fromRef.d.ts(2,10): error TS2305: Module '"/Users/tarek/Documents/Development/web_app/apphoven-web/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
node_modules/rxjs/Subscriber.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subscriber'.
node_modules/rxjs/Subscription.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subscription'.
Am I correct that AngularFire 2 does not support Angular 6? Because it's not written anywhere. And I don't think it's a good idea to downgrade to the old Angular CLI... So, what can I do?
Upvotes: 3
Views: 5677
Reputation: 3108
You've to fix your Rxjs imports. There are some changes in the use of rxjs from v6 onwards. so, Kindly import the observable as below
import { Observable } from 'rxjs';
instaed of import { Observable } from 'rxjs/Observable';
Hope this will fix your issue. Happy coding :)
Upvotes: 1
Reputation: 61
Add following code in polyfills.ts (window as any).global = window;
Upvotes: 1