问题
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