Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please verify the following:
yarn build-and-test:local
passesI have added tests for any new features, if relevant!README.md
(or relevant documentation) has been updated with your changesDescribe your PR
Fixes #1517 where calling
console.log
withnull
resulted in a blank screen. Now the comments around the function say that it only handlesstring
,object
,number
, andboolean
; however, the function takes amessage
of typeany
. Seems like we could narrow that down a bit. I've checked with all of the possible return values fortypeof
and documented that in the code.The reason the bug existed is because
typeof null
results inobject
. The code -- nor many people-- were expecting that. Here's the reference to the docs as to why: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_nullIt appears that we do some things to not return functions as strings and we don't handle
Symbol
. Not sure if that's a requirement based on what the comments around the function say that it should accept as a message type.getPreview
function returned just the raw message if we didn't discern what type it was. That seems like a bug. If someone has context as to why that was the case, I'd love to understand why.Screenshot
This is what it looks like now:
Here's another case where we didn't handle
null
correctly and now we do:Happy Debugging 😎