Angular 7 Rxjs forkJoin unable to add new Observable to the existing list ie. more than 6 parameters

自作多情 提交于 2021-02-11 14:41:50

问题


I am using rxjs forkjoin to make multiple http request. forkjoin takes 7 parameters To the existing code, i just adding new observable. but for some reason it is throwing error which is really weird. Here is the existing code:

const countries = this.referenceDataApiService.getLoadAndDischargeCountries();
const currencies = this.referenceDataApiService.getCurrencies();
......
forkJoin([countries, currencies,..,..,..,..,xxx]).subscribe((results) => {
  this.countries = results[0] ? results[0].sort() : [];
  this.currencies = results[1] ? results[1].sort() : [];
...removed rest of code for brevity

}

The above code works fine and when i mouse over results, it shows the pipe separated array for countries and currencies. As soon as i add new observable to the list, i am getting error saying 'The property 'sort' does not exist on type.....

Code i am adding is:

const trades =   this.referenceDataApiService.getTradeTypes();

forkJoin([countries, currencies, trades]).subscribe((results) => {

Can anyone help me what am i doing wrong here?

thanks

来源:https://stackoverflow.com/questions/60434304/angular-7-rxjs-forkjoin-unable-to-add-new-observable-to-the-existing-list-ie-mo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!