Includes the types that are not valid JSON values and will be:
object.[null] if found in an array.bigint will throw an error.
In theory bigint can be handled by monkey patching BigInt.prototype.toJSON = ...,
then converted to an object and parsed with a custom JSON parser.
Which is out of scope in this context.
Warnings, things TS cannot protect you against:
Infinity and NaN will be converted to null.JSON.stringify( { a: undefined, b: () => {}, c: Symbol( '' ) } ) // '{}'
JSON.stringify( undefined ) // undefined
JSON.stringify( () => {} ) // undefined
JSON.stringify( Symbol( 's' ) ) // undefined
JSON.stringify( [ undefined, () => {}, Symbol( 's' ) ] ) // '[ null, null, null ]'
JSON.stringify( BigInt( 1 ) ) // Type Error
All JSON bad values types.