Why does returning interval(500) throw the following type error in the code below?
const source = timer(0, 5000);
const example = source.pipe(switchMap(() => interval(500)));
const subscribe = example.subscribe(val => console.log(val));
Argument of type 'UnaryFunction<Observable<number>, Observable<number>>' is not assignable to parameter of type 'OperatorFunction'.
Types of parameters 'source' and 'source' are incompatible.
Type 'Observable<any>' is not assignable to type 'Observable<number>'.
Property 'source' is protected but type 'Observable<T>' is not a class derived from 'Observable<T>'.
This is the from the first switchMap example found on learnrxjs.io.