Skip to content
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

Merged
merged 1 commit into from
Feb 15, 2017
Merged

docs(ObservableInput): add ObservableInput and SubscribableOrPromise descriptions #2373

merged 1 commit into from
Feb 15, 2017

Conversation

mpodlasin
Copy link
Contributor

Description:

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.

Related issues:
#2326
#2344
#2351

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.68% when pulling ede2fff on Podlas29:observable-input-docs into 25ee5b3 on ReactiveX:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.68% when pulling 326bf0e on Podlas29:observable-input-docs into 25ee5b3 on ReactiveX:master.

Copy link
Member

@jayphelps jayphelps left a 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.
Copy link
Member

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.
Copy link
Member

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.
@coveralls
Copy link

coveralls commented Feb 15, 2017

Coverage Status

Coverage remained the same at 97.68% when pulling ede2fff on Podlas29:observable-input-docs into 25ee5b3 on ReactiveX:master.

@mpodlasin
Copy link
Contributor Author

@jayphelps I made the changes you requested.

@jayphelps jayphelps merged commit 7839002 into ReactiveX:master Feb 15, 2017
@lock
Copy link

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants