Skip to content

Property 'map' does not exist on type 'AngularFireAuth' #747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
asqwrd opened this issue Dec 28, 2016 · 8 comments
Closed

Property 'map' does not exist on type 'AngularFireAuth' #747

asqwrd opened this issue Dec 28, 2016 · 8 comments

Comments

@asqwrd
Copy link

asqwrd commented Dec 28, 2016

Version info

Angular: 2.3.0

Firebase: 3.x

AngularFire: next

I am still getting this issue. My code will not compile looking at the source AngularFireAuth extends ReplaySubject which is not an observable. Also i am compliling using AOT

my code lookes like this

export class UserResolve implements Resolve<any> {
  constructor(private api: ApiService,public af:AngularFire) {
  }

  resolve(route: ActivatedRouteSnapshot) {
     // should return an observable
    return this.af.auth.map((data)=>{
      return data;
    });
  }
}

when i run the compile it gives me the error Property 'map' does not exist on type 'AngularFireAuth'
im not sure how this is working for everyone else but it fails for me everytime and i am on the next release

@rosslavery
Copy link
Contributor

This seems to be an issue with the @next release.

It is because rxjs is being installed as a dependency, along with being installed with your application (so it's installed twice).

Because of this, the operators / inheritance that AngularFire uses to extend type Observable is breaking.

To test this, remove the rxjs folder that is inside node_modules/angularfire2/node_modules/rxjs. That should fix the issue.

I'm not sure why exactly rxjs is being installed in the @next release, but not in the beta6 release, but perhaps something changed in the rxjs package itself.

Regardless, I believe that rxjs needs to be moved to peerDependencies along with firebase.

@asqwrd
Copy link
Author

asqwrd commented Dec 28, 2016

will this be fixed soon i install via npm so id like to not have to edit the package manually

@rosslavery
Copy link
Contributor

What I've done in the meantime is set up a postinstall node script that just deletes that folder.

@katowulf
Copy link
Contributor

Thanks for the updates, all. We're looking at making rxjs a peer dependency (right now it appears to get installed as both peer and non-peer dep for some reason). For now the best workaround is to indeed delete one or modify package.json accordingly.

will this be fixed soon i install via npm so id like to not have to edit the package manual

Please don't use @next and stick to stable versions--or what passes as stable in a beta product--if you're not tolerant of small obstacles like this. This has also been out less than a day, so reset you expectations to something more realistic: we work in weeks and months, not hours (although I wouldn't expect this to be around for months).

@angular angular locked and limited conversation to collaborators Dec 28, 2016
@angular angular unlocked this conversation Dec 29, 2016
@davideast
Copy link
Collaborator

davideast commented Dec 29, 2016

@asqwrd What version of rxjs were you using?

@rosslavery @katowulf

I released a new next that includes the fix for Firebase, Angular, and rxjs as peerDependencies only.

Can you give it a spin and let me know if works for you?

@rosslavery
Copy link
Contributor

Just got back into the office, can confirm that all looks good here now.

@asqwrd
Copy link
Author

asqwrd commented Jan 3, 2017 via email

@Elrhino
Copy link

Elrhino commented Apr 2, 2017

@davideast I'm still having this issue on 2.0.0-beta.8. I'm using rxjs 5.0.1 and Angular 2.4.8.

The code:
return this.af.auth.map(auth => this.fooApi.getBarsByUserId(auth.uid));

The error:
error: this.af.auth.map is not a function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants