Merge pull request #5909 from Microsoft/patch-stringify

Use typeof to check for presence of `JSON` global
This commit is contained in:
Wesley Wigham 2015-12-02 21:19:24 -08:00
commit b14b7e9172

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;