I looked at the example in a GitHub repository. The application runs successfully and the written code works fine, but I'm having the following error in my Visual Studio Code:
The 'this' context of type' EventEmitter 'is not assignable to method's' this' of type' Observable '. \ n Types of property' lift 'are incompatible. \ n Type' (operator: Operator) = > Observable 'is not assignable to type' (operator: Operator) = > \ N Type 'string' is not assignable to type 'R'. \ N Type 'Observable' is not assignable to type 'Observable'.
The code that is generating the error is as follows:
this.notificationService.notifier
.do(message => {
this.message = message;
this.snackVisibility = 'visible';
})
.switchMap(message => Observable.timer(2000))
.subscribe(timer => this.snackVisibility = 'hidden');
Although the application works perfectly VS Code gives me the error as shown in the image:
What would be the best solution to this error?