Skip to content

Commit

Permalink
Use optional chaining when retrieving NODE_ENV
Browse files Browse the repository at this point in the history
this will fix the issue where globalThis.process.env is undefined and it is still trying to retrieve NODE_ENV
  • Loading branch information
johnfabre authored and John Erwin Fabre committed Feb 12, 2024
1 parent 9c90a23 commit dd99b7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/jsutils/instanceOf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 != null && globalThis.process.env != null && globalThis.process.env.NODE_ENV === 'production'
? function instanceOf(value: unknown, constructor: Constructor): boolean {
return value instanceof constructor;
}
Expand Down

0 comments on commit dd99b7e

Please sign in to comment.