From 9d261946976f51fbf8ad7982cb9e5dd6e2cb7acf Mon Sep 17 00:00:00 2001 From: Michael Birchler Date: Tue, 6 Feb 2024 11:01:51 +0100 Subject: [PATCH] fix(jsutils): use optional chaining to prevent crash in browser --- src/jsutils/instanceOf.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jsutils/instanceOf.ts b/src/jsutils/instanceOf.ts index c84bcb2afc..d209d8a626 100644 --- a/src/jsutils/instanceOf.ts +++ b/src/jsutils/instanceOf.ts @@ -9,7 +9,7 @@ import { inspect } from './inspect.js'; export const instanceOf: (value: unknown, constructor: Constructor) => boolean = /* c8 ignore next 6 */ // FIXME: https://github.com/graphql/graphql-js/issues/2317 - globalThis.process != null && globalThis.process.env.NODE_ENV === 'production' + globalThis?.process?.env?.NODE_ENV === 'production' ? function instanceOf(value: unknown, constructor: Constructor): boolean { return value instanceof constructor; }