You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At first I was like "oh really? I never knew that Map and Set are converted to empty objects by JSON.stringify(), that's interesting, let's try that!". And indeed:
However, that line that I linked to, is still a bug, I believe. Because the {} there is not representing an empty object value, but instead it represents the {} type, which as far as I know means any non-nullish type. So instead you should use your own EmptyObject type, don't you think?
The text was updated successfully, but these errors were encountered:
The title ends with a question mark, because I've literally never installed this package before. I was just reading the source code out of interest.
And while reading the code for
Jsonify
, I saw something that looked like a bug to me. Namely here:https://github.com/sindresorhus/type-fest/blob/main/source/jsonify.d.ts#L103
At first I was like "oh really? I never knew that
Map
andSet
are converted to empty objects byJSON.stringify()
, that's interesting, let's try that!". And indeed:However, that line that I linked to, is still a bug, I believe. Because the
{}
there is not representingan empty object value
, but instead it represents the{}
type, which as far as I know meansany non-nullish type
. So instead you should use your ownEmptyObject
type, don't you think?The text was updated successfully, but these errors were encountered: