#Namespace has no exported member "User" error in my project

17 messages · Page 1 of 1 (latest)

signal lake
#
import { AngularFireAuth } from '@angular/fire/compat/auth';
import { Observable } from 'rxjs';




@Injectable({
  providedIn: 'root'
})
export class AuthService {

  user: Observable<firebase.User>
  
  
  constructor(private fa: AngularFireAuth) { 
    this.user = this.fa.user
  }

    

    signUp(email: string,password: string){
      return this.fa.createUserWithEmailAndPassword(email,password)
    }
  signIn(email: string, password: string) {
      return this.fa.signInWithEmailAndPassword(email,password)
    }
}```
#

Error: src/app/services/auth.service.ts:13:29 - error TS2694: Namespace '"C:/Users/Admin/Desktop/rent-fire/node_modules/@angular/fire/node_modules/firebase/compat/index"' has no exported member 'User'.

distant phoenix
signal lake
#

When i add import firebase from 'firebase/compat/app';

#
  Type 'User | null' is not assignable to type 'User'.
    Type 'null' is not assignable to type 'User'.

19     this.user = this.fa.user```
#

I got this error

distant phoenix
#

Have you read the message and tried to figure out what it means?

signal lake
#

I'm new on firebase i'm so sorry. I don't know exactly what i'm gonna do.

distant phoenix
#

That has nothing to do with firebase.

#

What does the message mean? Try to reword it in your own words.

#

Note that it's about line 19 in your code.

signal lake
#

I solved the problem

#

with adding | null

#

thank you so much