Type '() => Observable <any>' is not assigned to type '() => Observable <any>'

I am making an ionic application 2 using typescript and after updating the local typescript installation to version 2.2.1from version 2.1.0I started getting this error:

Type '() => Observable' is not assigned to type '() => Observable. Two different types exist with this name, but they are not related. The type "Observable" is not assigned to the type "Observable". There are two different types with this name, but they are not related.

This error is repeated for each of the following lines.

L28:  this.onDisconnect = Network.onDisconnect
L29:  this.onchange = Network.onchange
L30:  this.ontypechange = Network.ontypechange

Networkis a class imported from ionic-nativeits methods onDisconnect, onchangeand ontypechangeis defined as follows:

static onDisconnect(): Observable<any>;
static onchange(): Observable<any>;
static ontypechange(): Observable<any>;

onDisconnect, onchange ontypechange public (@Injectable() class), "", :

L15:  public onDisconnect: ()=>Observable<any>
L16:  public ontypechange: ()=>Observable<any>
L17:  public onchange: ()=>Observable<any>

?

: , typescript .

: , , . , public, static ?

-: ?

EDIT:

, , -

+4
1

rxjs, node_modules, TS , " ".

, , - node_modules, npm npm install.

, , , , rxjs, , npm rxjs ( node_modules ). , ​​

node_modules
  dependencyA
  rxjs
  dependencyB
    node_modules
      rxjs

, , , . , package.json rxjs: "^5.2.0", dependencyB/package.json rxjs: "5.0.0".

+2

Source: https://habr.com/ru/post/1672772/


All Articles