8000 use typeof to check for presence of `JSON` global · nycdotnet/TypeScript@a5a6c10 · GitHub
[go: up one dir, main page]

Skip to content

Commit a5a6c10

Browse files
committed
use typeof to check for presence of JSON global
1 parent a4770af commit a5a6c10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,7 @@ namespace ts {
24002400
* Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph
24012401
* as the fallback implementation does not check for circular references by default.
24022402
*/
2403-
export const stringify: (value: any) => string = JSON && JSON.stringify
2403+
export const stringify: (value: any) => string = typeof JSON !== "undefined" && JSON.stringify
24042404
? JSON.stringify
24052405
: stringifyFallback;
24062406

0 commit comments

Comments
 (0)
0