I'm currently trying to make the timeout () method of Angular 2 Observed fine, but all the tutorials have similair code, where the second argument to the timeout () method is a simple error:
return this.http.get('http://...') .timeout(2000, new Error('Timeout exceeded'));
But when I copy this code, TypeScript says that the second argument is of an invalid type and expects to see smth, which implements the IScheduler interface.
One way to solve the problem is to create a new class that implements the IScheduler interface, but it has functionality that I am not familiar with (the now () method and tasks).
Does anyone know if I should do it this way or are there other ways to make everything work? But what if, instead of an error, I want to place a callback function?
source share