TypeError: Right-hand side of 'instanceof' is not an object#38350
TypeError: Right-hand side of 'instanceof' is not an object#38350rifler wants to merge 1 commit intoangular:masterfrom
Conversation
|
Hi @rifler, thanks for creating this PR. It looks like it's missing some critical information to make this PR actionable, specifically:
I will close this PR for now, feel free to reopen or create a new one once you have the necessary information and tests. Thank you. |
|
@AndrewKushnir |
|
@AndrewKushnir I create an issue - #38361 but cannot reopen pull-request |
|
@rifler I've re-opened this PR based on #38361 (comment). Thank you. |
There was a problem hiding this comment.
instead of using try/catch, I think maybe
if (typeof Promise !== 'undefined' && this instanceof Promise) {
return PROMISE_OBJECT_TO_STRING;
}
will be better, although the code still fails if some app set Promise to some invalid value such as window.Promise = 1, but in that case, the app already fails in a lot of other places.
|
@rifler, thanks and year |
|
LGTM after @JiaLiPassion comments are resolved. |
|
@JiaLiPassion can you please give me advice how to write unit test for Maybe type checking is enough here? |
|
All (the pull request submitter and all commit authors) CLAs are signed, but 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 by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
|
@rifler , I just added one test case.
|
…unction Close angular#38361 zone.js monkey patch toString, and check the instance is `Promise` or not by using `instanceof Promise`, sometimes when Promise is not available, the `instanceof` operation fails and throw `TypeError: Right-hand side of 'instanceof' is not an object` this PR check `typeof Promise` equals to function or not to prevent the error.
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
fixed |
|
LGTM. |
…unction (#38350) Close #38361 zone.js monkey patch toString, and check the instance is `Promise` or not by using `instanceof Promise`, sometimes when Promise is not available, the `instanceof` operation fails and throw `TypeError: Right-hand side of 'instanceof' is not an object` this PR check `typeof Promise` equals to function or not to prevent the error. PR Close #38350
…unction (angular#38350) Close angular#38361 zone.js monkey patch toString, and check the instance is `Promise` or not by using `instanceof Promise`, sometimes when Promise is not available, the `instanceof` operation fails and throw `TypeError: Right-hand side of 'instanceof' is not an object` this PR check `typeof Promise` equals to function or not to prevent the error. PR Close angular#38350
…ise is function (angular#38350)" This reverts commit f4b034d.
…unction (angular#38350) Close angular#38361 zone.js monkey patch toString, and check the instance is `Promise` or not by using `instanceof Promise`, sometimes when Promise is not available, the `instanceof` operation fails and throw `TypeError: Right-hand side of 'instanceof' is not an object` this PR check `typeof Promise` equals to function or not to prevent the error. PR Close angular#38350
|
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. |
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?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information