Skip to content

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

Closed

Description

@asqwrd

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

Activity

  1. rosslavery commented on Dec 28, 2016

    @rosslavery
    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.

  2. asqwrd commented on Dec 28, 2016

    @asqwrd
    Author

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

  3. rosslavery commented on Dec 28, 2016

    @rosslavery
    Contributor

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

  4. katowulf commented on Dec 28, 2016

    @katowulf
    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).

  5. locked and limited conversation to collaborators on Dec 28, 2016
  6. unlocked this conversation on Dec 29, 2016
  7. davideast commented on Dec 29, 2016

    @davideast
    Collaborator

    @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?

  8. rosslavery commented on Jan 3, 2017

    @rosslavery
    Contributor

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

  9. asqwrd commented on Jan 3, 2017

    @asqwrd
    Author
  10. Elrhino commented on Apr 2, 2017

    @Elrhino

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions