Environment
Any environment, any version. Present from the start it seems like.
Reproduction
Running isJSONSerializable(null) serves sufficiently as a reproduction of the bug.
Describe the bug
This line has a bug.
|
if (t === "string" || t === "number" || t === "boolean" || t === null) { |
Firstly, t (typeof value) will never triple equal null. (dead code)
Secondly, null as a value is JSON serializable. This util function will not identify it as such.
Thirdly, if you provide null to this util function, it will throw:
Uncaught TypeError: Cannot read properties of null (reading 'buffer')
at isJSONSerializable
Additional context
Can I create a PR fix?
Logs
Environment
Any environment, any version. Present from the start it seems like.
Reproduction
Running
isJSONSerializable(null)serves sufficiently as a reproduction of the bug.Describe the bug
This line has a bug.
ofetch/src/utils.ts
Line 22 in dfbe3ca
Firstly, t (typeof value) will never triple equal null. (dead code)
Secondly, null as a value is JSON serializable. This util function will not identify it as such.
Thirdly, if you provide null to this util function, it will throw:
Additional context
Can I create a PR fix?
Logs