Skip to content

refactor(core): remove isObservable TODO#39669

Closed
petebacondarwin wants to merge 1 commit intoangular:masterfrom
petebacondarwin:core-remove-is-observable-todo
Closed

refactor(core): remove isObservable TODO#39669
petebacondarwin wants to merge 1 commit intoangular:masterfrom
petebacondarwin:core-remove-is-observable-todo

Conversation

@petebacondarwin
Copy link
Contributor

This commit removes the TODO comment that proposed
that we use the built-in RxJS isObservable() function.

This is not a viable approach since the built-in function
requires that the obj contains additional methods that
our "observable" types (such as EventEmitter) do not
necessarily have.

See #39643 for more information.

This commit removes the TODO comment that proposed
that we use the built-in RxJS `isObservable()` function.

This is not a viable approach since the built-in function
requires that the `obj` contains additional methods that
our "observable" types (such as `EventEmitter`) do not
necessarily have.

See angular#39643 for more information.
@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer refactoring Issue that involves refactoring or code-cleanup area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release action: presubmit The PR is in need of a google3 presubmit labels Nov 13, 2020
@google-cla google-cla bot added the cla: yes label Nov 13, 2020
@ngbot ngbot bot added this to the needsTriage milestone Nov 13, 2020
@pullapprove pullapprove bot requested a review from AndrewKushnir November 13, 2020 08:09
export function isObservable(obj: any|Observable<any>): obj is Observable<any> {
// TODO: use isObservable once we update pass rxjs 6.1
// https://github.com/ReactiveX/rxjs/blob/master/CHANGELOG.md#610-2018-05-03
return !!obj && typeof obj.subscribe === 'function';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be fair, shouldn't this method be renamed to isSubscribable? It literally checks whether the given object can be subscribed to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but to be consistent that is a bigger change, which would involve us changing our use of Observable to Subscribable across the framework.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, agreed. This is also somewhat addressed in #39627 where it actually is renamed to isSubscribable and isObservable is still exported as a type assertion on that function.

@atscott atscott added action: merge The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit labels Nov 16, 2020
@atscott atscott removed the request for review from AndrewKushnir November 16, 2020 17:26
@atscott atscott removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Nov 16, 2020
atscott pushed a commit that referenced this pull request Nov 16, 2020
This commit removes the TODO comment that proposed
that we use the built-in RxJS `isObservable()` function.

This is not a viable approach since the built-in function
requires that the `obj` contains additional methods that
our "observable" types (such as `EventEmitter`) do not
necessarily have.

See #39643 for more information.

PR Close #39669
@atscott atscott closed this in 7bcfc0d Nov 16, 2020
@petebacondarwin petebacondarwin deleted the core-remove-is-observable-todo branch November 19, 2020 10:14
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime cla: yes refactoring Issue that involves refactoring or code-cleanup target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments