我正在将离子3.8应用程序迁移到3.9.2.此迁移包括对RXJS 5.5的更新
我现在遇到这个错误:
TypeError: this._subscribe is not a function. (In 'this._subscribe(sink)', 'this._subscribe' is an instance of t)
经过几个小时的调试,我发现这个代码部分与错误有关:
protected observeConnectionState() {
// rxjs/observable/of
of(new Event('disconnect'))
.pipe(
// rxjs/operators/merge
merge(connect$),
merge(disconnect$),
// Map eventname to string (rxjs/operators/map)
map((e: IEvent) => {
return e.eventName == 'connect' ? 'connected' : 'disconnected';
})
)
// Apply to class context
.subscribe((newConnectionState) => {
// this.connectionState$ is a BehaviorSubject
this.connectionState$.next(newConnectionState);
});
}
Run Code Online (Sandbox Code Playgroud)
附加信息
this._subscribe:Observable.ts第203行和Observable.ts第208行.