From a5a6c10322ed2fbdb04180d32abb14bc9a8a86a2 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 2 Dec 2015 21:06:32 -0800 Subject: [PATCH] use typeof to check for presence of `JSON` global --- src/compiler/utilities.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 280b8203ff4..95bf4ff7fa3 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -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;