To use the never
function from the rxjs
library in TypeScript, first you need to import it as follows:
index.ts30 chars2 lines
The never
function returns an Observable
that never emits any values and never completes or errors out. This could be useful when you want to represent an empty stream that will not emit any values.
Here is an example of using the never
function to create an empty Observable
:
index.ts221 chars10 lines
In this example, the empty$
Observable
will never emit any values and will never complete or error out, so none of the subscribe
callback functions will ever be called.
gistlibby LogSnag