question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typing of of Observable.create

See original GitHub issue

RxJS version: 4.5.2

The TypeScript signature for Observable.create is just:

static create: Function;

Is there a reason it can’t be given a richer type?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
david-driscollcommented, Aug 9, 2017

Because TypeScript does not let static properties type change from parent to base classes, and subject’s create method takes 2 arguments.

https://github.com/ReactiveX/rxjs/blob/d2a32f9a18ebbf65bea798f558364571c91a9d79/src/Subject.ts#L42

FWIW I’ve just switched to using the constructor and it works just fine, and frankly that’s all create is doing anyway.

new Observable<T>(o => {
});
0reactions
lock[bot]commented, Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

what's the correct way to create a typed Observable with RxJS?
Just use a subject myWork$ = new Subject<MyData>();. and you can call next when you want it to emit update(data: MyData) { this....
Read more >
Using observables to pass values - Angular
Use the Observable constructor to create an observable stream of any type. The constructor takes as its argument the subscriber function to run...
Read more >
Observable - RxJS
An Observable is a lazily evaluated computation that can synchronously or asynchronously return zero to (potentially) infinite values from the time it's invoked ......
Read more >
Creating Observables in RxJS - This Dot Labs
The fromEvent operator will create an Observable that pushes a every event of a specified type that has occurred on a specified event...
Read more >
Create operator - ReactiveX
You can create an Observable from scratch by using the Create operator. You pass this operator a function that accepts the observer as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found