0

Given the following code

getExchangeRates(source: string, target: string, from: string = "", to: string = "") {
  return this.exchangeRateDataService.getExchangeRates({ source, target, from, to })
    .pipe(
      map((response: HttpResponse<ExchangeRates>): ExchangeRates | undefined => {
          return response.body ? from(response.body) : of([]);
      })
    );
}


Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures.

My issue is that I can't use the rxjs from method, because the from variable creates a naming conflict. Is there any alias available for the rxjs from() method? Is there any other way to solve this issue? (Modifying the interface is not an option, I can't change 'from' to 'fromDate')

Thanks in advance.

1 Answer 1

4

If you can't change the name of the variable you could use the import as syntax to change the name of the method:

import { from as rxFrom } from 'rxjs';

then use it:

return response.body ? rxFrom(response.body) : of([]);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.