I want to make an observable that when a subscribed to emits a boolean , i tried a lot of combinations but nothing seems to work.
example:
let myObservable = new Observable<boolean>(item => {
console.log("from observable")
});
let otherObservable = myObservable.pipe(map( item => {
return true
}))
otherObservable.subscribe(item => {
console.log("from subscribtion")
console.log(item)
})
here , myObservable needs to prepare a boolean for when the subscriber subscribes console.log(item) needs to be the value of the boolean
when i try it like this :
let myObservable = new Observable<boolean>(item => {
return true
});
myObservable.subscribe(item => {
console.log("from subscribtion")
console.log(item)
})
i get an error stating that :
Argument of type '(this: Observable, item: Subscriber) => boolean' is not assignable to parameter of type '(this: Observable, subscriber: Subscriber) => TeardownLogic'. Type 'boolean' is not assignable to type 'TeardownLogic'.
What am i missing? any help would be appreciated