-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(ObservableInput): add ObservableInput and SubscribableOrPromise descriptions #2373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super super helpful. Gosh this is helpful.
src/MiscJSDoc.ts
Outdated
* `ObservableInput` interface describes all values that are observables, | ||
* or can be treated as such. Every operator that accepts arguments annotated | ||
* with this interface, can be also used with parameters that are not necessarily | ||
* RxJS Observables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two descriptions for SubscribableOrPromise
and ObservableInput
seem to start with the same statement but not entirely accurate.
X interface describes all values that are observables, or can be treated as such.
* Operators will accept both built-in and custom ES6 Iterables, by treating them as | ||
* observables that emit all its values in order of iteration and then complete | ||
* when iteration ends. Note that contrary to arrays, Iterables do not have to | ||
* necessarily be finite, so creating Observables that never complete is possible as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The infinite iterator use case is not well known but very powerful and easy with generators. I think an example that uses generators would be very very useful.
// infinite stream of incrementing numbers
const infinite = function* () {
let i = 0;
while (true) {
yield i++;
}
};
Rx.Observable.from(infinite())
.take(3) // only take 3, cause this is infinite
.subscribe(
value => console.log(value),
err => {},
() => console.log('ta dam!')
);
// 0
// 1
// 2
…descriptions Add ObservableInput and SubscribableOrPromise interface descriptions, as well as link these interfaces in type descriptions of operators, so that users always know what kind of parameters they can pass to used methods.
@jayphelps I made the changes you requested. |
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. |
Description:
Add
ObservableInput
andSubscribableOrPromise
interface descriptions, as well as link these interfaces in type descriptions of operators, so that users always know what kind of parameters they can pass to used methods.Related issues:
#2326
#2344
#2351