I've successfully created an observable from an array, but the issue is that its type
shows as Observable<number>
instead of Observable<number[]>
getUsers(ids: string[]): Observable<number[]> {
const arraySource = Observable.from([1, 2, 3, 4, 5]);
//output: 1,2,3,4,5
const subscribe = arraySource.subscribe(val => console.log(val));
let returnObserable = Observable.from([1, 2, 3, 4, 5]);
return returnObserable; //an error occurs at this line due to the return type mismatch
}
Would there be another method to create observables apart from using the 'from' function?