Error: Cannot assign boolean type argument to a parameter that expects a function with string and index parameters returning an ObservableInput

While working with this code snippet, I encountered the following error message: '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()
   }

The specific line causing the issue is:

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

I've included the method being called for reference:

    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)
      })
    )
  }

Answer №1

The issue lies in the spacing between = > in

res = > this.crudservice.updateProfileData({res})
. It is important to note that the function operator cannot contain a space as it could lead to an assignment with a greater-than boolean operation.

To resolve the problem, the code should be modified as follows:

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

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Display elements conditionally based on the result of an asynchronous operation within an ng

Using Angular version 11.0.2 I am encountering issues with the async pipe inside an ngIf template, where my data is not being properly refreshed. To illustrate this problem, I have created a simplified example. View code on Plunker To reproduce the issu ...

I'm looking for a way to modify my standard function so that it can receive warnings

Below is my function called defc export function defc<T extends Record<string,any> >(f:(a:T)=>void){ return function(a:T){ return f(a) } } The purpose of this function is to ensure the correct return type of func ...

Unable to compile Webpack due to aws-jwt-verify issue

Trying to package node code for an AWS lambda function with lambda@edge, and running into an error. Module not found: Error: Can't resolve 'aws-jwt-verify/error' Typescript compiles successfully with TSC, but webpack throws this error durin ...

Preview of Angular 2+ Component Documentation in HTML format

Is there a way to create documentation for Angular components that will appear as a tooltip when inserting a new component in HTML? I am currently using Webstorm. For example: If I have Component A /** * This documentation should be displayed in the to ...

Translate language in an Angular file using TypeScript

const typeArray= [ { id: 'PARENT', name: '{{ appConstants.type.PARENT | translate }}' }]; What is the best way to incorporate translations when declaring an array in a TypeScript file? ...

Upgrade the Firebase functions node.js version to either ^14.18.0 or greater than or equal to 16.4.0

To get firebase Functions up and running, I am in need of version 14.18.0 or newer, ideally >=16.4.0. Firebase CLI v11.14.1 is not compatible with Node.js v12.14.1. It's recommended to update Node.js to version ^14.18.0 or >=16.4.0 After attemp ...

Tips for validating Enum Strings using the newest version of Joi?

Is there a way to validate Enum String? In the past, I followed this advice from: https://github.com/hapijs/joi/issues/1449 enum UserRole { Admin = 'admin', Staff = 'staff' } const validator = { create: Joi.object().keys({ ...

Distinguish private member unions in Typescript

Struggling with discriminating between private class member types? Attempting to access variables v1 and v2 using string literals resulting in type union issues. With a bit of tweaking, I found a workaround for public members only. Check out this example: ...

steps for obtaining a specific value from a dropdown menu

I'm currently developing a backend application using spring boot and a frontend in angular 5. One of the tasks I'm working on involves creating a dropdown list. Below is the code snippet for the dropdown: <select #selectElem (change)="onSelec ...

Issue with Ionic 3 subscribes triggering repeatedly

I've been struggling with the code for an Ionic taxi app for a few weeks now. My main issue is that whenever the page loads, the subscription gets triggered multiple times along with other functions within it. The same problem occurs when any travel i ...

How to host an Angular 2 application on IIS-10 without using ASP.NET Core

I've managed to create a plane angular-2 application using webpack in Visual Studio 2015 and now I'm looking to deploy it on IIS-10. Since I didn't use the ASP.NET Core template for this project, I need guidance on how to properly deploy thi ...

Passing template references in Angular using ng-content allows for dynamic rendering of

My goal is to utilize ng-template within a nested structure by passing it as ng-content to a child component. The HTML code for the app-component: <app-parent> <ng-template appTemplateRetrieval> <div>this content should be sent to ...

Angular 8 encountering issues with incomplete/impartial JSON parsing

Upon receiving a JSON object through a Socketio emit, the data appears as follows: { "single":[ { "name":"Xavi555", "data":[ { "_id":"5e2ea609f8c83e5435ebb6e5", "id":"test1", "author":"someone", ...

Tips for parsing through extensive JSON documents containing diverse data types

In the process of developing an npm package that reads json files and validates their content against predefined json-schemas, I encountered issues when handling larger file sizes (50MB+). When attempting to parse these large files, I faced memory allocati ...

Frequency-focused audio visualization at the heart of the Audio API

Currently, I am developing a web-based audio visualizer that allows users to adjust the raw audio signal visualizer to a specific frequency, similar to the functionality found in hardware oscilloscopes. The goal is for the wave to remain stationary on the ...

No output was generated by Typescript for the file located at '/path/to/file.ts'

My typescript library transpiles smoothly using tsc with the provided configuration: { "compilerOptions": { "target": "es6", "module": "commonjs", "lib": [ "es6", "es5", "dom", "es2017" ], "declaration": true, ...

Using ngFor in Angular 6 to create a table with rowspan functionality

Check out this functional code snippet Desire for the table layout: <table class="table table-bordered "> <thead> <tr id="first"> <th id="table-header"> <font color="white">No.</font> </th> <th id="table-hea ...

How can I update the component UI after using route.navigate in Angular 2?

I am attempting to update my user interface based on a list retrieved from a service. Here is the code snippet: HTML portion: <li *ngFor="let test of testsList" class="list-inline-item"> <div class="row m-row--no-padding align-items-cente ...

Wallaby.js - The async() test helper requires a Zone to function properly

This project is built with Angular 6.x and tests are conducted using Karma/Jasmine. I'm facing a challenge while using Wallaby where my tests run successfully outside of it, indicating a possible configuration issue. Specifically, when running tests ...

Linking all styles with Angular 2

Is it possible to apply a style when the exact nature of that style is unknown? Consider a scenario where I have a model containing string variables defining styles, as shown below: myStyle1:string="margin-left:10px"; myStyle2:string="margin ...