I have implemented the click-outside directive using this plunk --> http://embed.plnkr.co/v7BMUv/
But when I try to compile my TypeScript code, I encounter the following errors:
Error TS2322: Type 'Subscription' is not compatible with type 'Observable'. Property '_isScalar' is missing in type 'Subscription'.
Error TS2339: Property 'unsubscribe' does not exist on type 'Observable'.
This is how my tsconfig.json file looks like:
{
"compileOnSave": false,
"compilerOptions": {
"target": "es6",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"suppressImplicitAnyIndexErrors": true,
"noImplicitAny": false,
"noEmitOnError": false
},
"exclude": [
"node_modules",
"wwwroot"
]
}
The piece of code causing these errors is as follows:
ngOnInit() {
this.globalClick = Observable
.fromEvent(document, 'click')
.delay(1)
.do(() => {
this.listening = true;
}).subscribe((event: MouseEvent) => {
this.onGlobalClick(event);
});
}
How can I resolve this issue?