use typeof to check for presence of JSON global

This commit is contained in:
Wesley Wigham 2015-12-02 21:06:32 -08:00
parent a4770afc69
commit a5a6c10322

View File

@ -2400,7 +2400,7 @@ namespace ts {
* Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph
* as the fallback implementation does not check for circular references by default.
*/
export const stringify: (value: any) => string = JSON && JSON.stringify
export const stringify: (value: any) => string = typeof JSON !== "undefined" && JSON.stringify
? JSON.stringify
: stringifyFallback;