Creating observable that emits null is deprecated in v7? #5966
Replies: 4 comments 3 replies
-
I don't think emitting null itself is deprecated. Not sure if we have known issues, @cartant maybe aware? |
Beta Was this translation helpful? Give feedback.
-
Nope, it's definitely not. But whether or not it's interpreted as a scheduler probably depends on the TypeScript settings. Are The deprecations are something that still need work before the next version is released. This is also a good example of why the deprecation messages that are used ATM are not good enough - they confuse people. IMO, we need to get the messages sorted out and have them include links to documentation pages that explain the reasoning, etc. |
Beta Was this translation helpful? Give feedback.
-
I see. This is an issue with the type thinking |
Beta Was this translation helpful? Give feedback.
-
I think the problem here is due to the overloads ordering for the rxjs/src/internal/observable/of.ts Lines 7 to 70 in 4dd7118 TypeScript tries to apply overloads in order, from top to bottom. When presented with null as an argument, it picks the first matching overload, which in this case seems to be the first one with the scheduler parameter.
This is a problem not only with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a method like this in my project:
After installing RxJS 7.0.0-beta.10, there is now a deprecation notice saying "of is deprecated: The scheduler argument is deprecated, use scheduled." Is this a spurious warning since I'm not actually using a scheduler, or is the creation of observables that emit null/undefined values actually being deprecated? If the warning is spurious, is there a way to avoid triggering it for a single
null
value like this before RxJS 7 is finalized?Beta Was this translation helpful? Give feedback.
All reactions