zakaria mouqcit
zakaria mouqcit

Reputation: 393

Property 'sendEmailVerification' does not exist on type 'Promise<User>'.ts(2339)

I have this error :

Property 'sendEmailVerification' does not exist on type 'Promise<User>'.ts(2339)

my code :

// Send email verfificaiton when new user sign up
  SendVerificationMail() {
    return this.afAuth.currentUser.sendEmailVerification()
    .then(() => {
      this.router.navigate(['verify-email-address']);
    })
  }

I don't know the origin of the error and what am I missing?

Upvotes: 1

Views: 916

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598728

You'll need to wait until the promise resolves:

  SendVerificationMail() {
    return this.afAuth.currentUser.then((user) => {
      return user.sendEmailVerification();
    }).then(() => {
      this.router.navigate(['verify-email-address']);
    })
  }   

Upvotes: 3

Related Questions