Skip to content

Commit

Permalink
fix(network): onChange no longer causes error (#3651)
Browse files Browse the repository at this point in the history
closes #3649
  • Loading branch information
EinfachHans authored Apr 15, 2021
1 parent 6c99c3b commit 16fee22
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/@ionic-native/plugins/network/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaCheck, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable, merge } from 'rxjs';
import { mapTo } from 'rxjs/operators';

declare const navigator: any;

Expand Down Expand Up @@ -99,7 +100,10 @@ export class Network extends IonicNativePlugin {
*/
@CordovaCheck()
onChange(): Observable<'connected' | 'disconnected'> {
return merge(this.onConnect().pipe(mapTo('connected')), this.onDisconnect().pipe(mapTo('disconnected'));
return merge(
this.onConnect().pipe(mapTo('connected')),
this.onDisconnect().pipe(mapTo('disconnected')) as Observable<'disconnected'>
);
}

/**
Expand Down

0 comments on commit 16fee22

Please sign in to comment.