Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Argument of type 'boolean' is not assignable to parameter of type '(value: string, index: number) => ObservableInput' [closed]

on this code snippet, i am getting the error stated above as 'Argument of type 'boolean' is not assignable to parameter of type '(value: string, index: number) => ObservableInput'

  onFileSelected(event: any, user: any){
   this.crudservice.upload(event.target.files[0], `images/profile/${user.uid}`).pipe(
     concatMap(res = > this.crudservice.updateProfileData({res}))
    ).subscribe()
   }

more specifically this line:

res = > this.crudservice.updateProfileData({res})

I will leave this here for reference on the method being called:

    updateProfileData(profileData: any){
    const user = firebase.auth().currentUser
    return of(user).pipe(
      concatMap(user =>{
        if(!user) throw new Error('Not Authenticated');
        return updateProfile(user,profileData)
      })
    )
  }
like image 896
Isaac Lyne Avatar asked Oct 25 '25 14:10

Isaac Lyne


1 Answers

The problem is the space between = > in res = > this.crudservice.updateProfileData({res}). The function operator cannot have a space between otherwise it's an assignment with a greater-then boolean operation.

The following should work:

onFileSelected(event: any, user: any){
   this.crudservice.upload(event.target.files[0], `images/profile/${user.uid}`).pipe(
     // Fix here   v
     concatMap(res => this.crudservice.updateProfileData({res}))
   ).subscribe()
}
like image 58
lepsch Avatar answered Oct 27 '25 02:10

lepsch