Property 'next' does not exist on type 'Observable<{}>'

白昼怎懂夜的黑 提交于 2019-12-10 18:28:06

问题


trying to do the following

let o = new Observable() ;
o.delay( 3000 ).next( { stuff } ) ;

Getting the following error

[ts] Property 'next' does not exist on type 'Observable<{}>'

also tried

Let o = new Subject(); 
o.delay( 3000 ).next( { stuff } ) ;

Still getting

[ts] Property 'next' does not exist on type 'Observable<{}>'.


回答1:


You need to call next on the Subject instance. The o variable from your example is then the Subject chained with the operator that returns an Observable.

const s = new Subject(); 
const o = s.delay(3000);

o.subscribe(...);

s.next();


来源:https://stackoverflow.com/questions/49401761/property-next-does-not-exist-on-type-observable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!