I made a service that returns a time Observable
,
time = new Observable(observer =>
setInterval(() => observer.next(new Date().toString()), 1000)
);
However, it gives the following error,
ERROR in src/app/services/date.service.ts(11,5): error TS2322: Type 'number' is not assignable to type 'TeardownLogic'.
I found this solution(Typescript Error: setInterval - Type 'Timer' is not assignable to type 'number') but to no avail.