服务.ts 文件
版本 5 代码:
return this.connectionListStoreService.connections$.pipe(
combineLatest(this.isLoadPending$),
filter(([connections, isPending]) => !isPending),
map(([connections]) => connections),
combineLatest(
this.adapterStoreService.adapters$,
this.applicationsStoreService.applications$
),
map(([connections, adapters, applications]) => {
if (!connections || !adapters || !applications) {
return;
}
return connections
.filter(connection => connection.source && connection.destination)
.map((connection) => ({
...connection,
source: {
...connection.source,
adapter: adapters.find((item) => item.id === connection.source.appTypeId),
application: applications.find((item) => item.id === connection.source.applicationId)
},
destination: {
...connection.destination,
adapter: adapters.find((item) => item.id === connection.destination.appTypeId),
application: applications.find((item) => item.id === connection.destination.applicationId)
}
}))
.filter(({ source, destination }) =>
source.application && source.adapter && destination.application && destination.adapter);
})
);
版本 6 代码:
return combineLatest([this.connectionListStoreService.connections$, this.isLoadPending$]).pipe(
filter(([connections, isPending]) => !isPending),
map(([connections]) => connections),
combineLatest([this.adapterStoreService.adapters$, this.applicationsStoreService.applications$]),
map(([connections, adapters, applications]) => {
if (!connections || !adapters || !applications) {
return;
}
return connections
.filter(connection => connection.source && connection.destination)
.map((connection) => ({
...connection,
source: {
...connection.source,
adapter: adapters.find((item) => item.id === connection.source.appTypeId),
application: applications.find((item) => item.id === connection.source.applicationId)
},
destination: {
...connection.destination,
adapter: adapters.find((item) => item.id === connection.destination.appTypeId),
application: applications.find((item) => item.id === connection.destination.applicationId)
}
}))
.filter(({ source, destination }) =>
source.application && source.adapter && destination.application && destination.adapter);
})
)
我将这段旧代码修改为一些在线指南的新代码。我面临嵌套combineLatest
在此函数中的问题:
错误:
@deprecated — 不再支持 resultSelector,而是通过管道映射
'Observable<[AdapterModel[], ApplicationModel[]]>' 类型的参数不可分配给'OperatorFunction<unknown, unknown>' 类型的参数。
类型 'Observable<[AdapterModel[], ApplicationModel[]]>' 提供不匹配的签名'(来源:Observable):Observable'.ts(2345)
RXJS 版本:“6.6.3”,
让我知道我这边是否需要任何其他信息。提前致谢。