Repository navigation
fix(core): throw error message when @Output not initialized - #19116
aldo-roman wants to merge 5 commits into
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
|
I signed it! |
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
|
I signed it! (again) |
|
CLAs look good, thanks! |
|
Yes, thank you! This thing always gets me |
|
Hello? Don't want to hassle you. Sure you're busy. But this PR has some merge conflicts that you probably ought to resolve. |
4800acc to
7b3c139
Compare
|
@mhevery Will this pull request be accepted? |
7b3c139 to
51ef8a0
Compare
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
|
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) |
There was a problem hiding this comment.
You should explicitely test for not !== null
(ie typeof null === 'object')
There was a problem hiding this comment.
@vicb fixup (correct detect isObject typeof):
if (outputObservable === Object(outputObservable)) {There was a problem hiding this comment.
@splincode did you forget to push the change to the branch? I don't see the fix here. Please check.
There was a problem hiding this comment.
oh, I see. @splincode you are not the PR owner. Do I understand correctly that you were just proposing that as the correct fix?
There was a problem hiding this comment.
@IgorMinar Yes, exactly, could you make fixup it?
There was a problem hiding this comment.
According to MDN:
The Object constructor creates an object wrapper for the given value. If the value is null or undefined, it will create and return an empty object, otherwise, it will return an object of a Type that corresponds to the given value. If the value is an object already, it will return the value.
As we do not want to create a new Object, (obs !== null && typeof obs === 'object') is probably the best ? (arguably we would only create a new object for invalid values)
There was a problem hiding this comment.
@vicb An observable doesn't necessarily be a class instance, but can also be a function (WIP in RxJS v7 for performance consideration), and due to bad JavaScript design typeof a function is not 'object'. Possibly just check not null (!= null instead of !== null) as the issue is for "not initialized".
There was a problem hiding this comment.
@trotyl Can I just do it this way?
const outputIsObservable = outputObservable && outputObservable.subscribe;
if (outputIsObservable) {
// ...
}or simplify
if (outputObservable instanceof Observable) {
// ...
}There was a problem hiding this comment.
@splincode It's already there, no need to duplicate:
angular/packages/core/src/util/lang.ts
Lines 23 to 26 in 3f20a2f
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
|
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) |
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
65dc6b6 to
375449e
Compare
|
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |


Closes #3664
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Listing an event in a directive without creating an associated EventEmitter instance results in cryptic error.
Issue Number: #3664
What is the new behavior?
Better error messages when an
@Outputproperty is not initialized.Does this PR introduce a breaking change?
Other information