Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove globalThis check and align with what bundlers can accept #4022

Open
wants to merge 4 commits into
base: 16.x.x
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/jsutils/instanceOf.ts
@@ -1,5 +1,14 @@
import { inspect } from './inspect';

/* c8 ignore next 4 */
const isProduction =
// eslint-disable-next-line no-undef
typeof process !== 'undefined' &&
// eslint-disable-next-line no-undef
process.env &&
// eslint-disable-next-line no-undef
process.env.NODE_ENV === 'production';
JoviDeCroock marked this conversation as resolved.
Show resolved Hide resolved

JoviDeCroock marked this conversation as resolved.
Show resolved Hide resolved
/**
* A replacement for instanceof which includes an error warning when multi-realm
* constructors are detected.
Expand All @@ -9,7 +18,7 @@ import { inspect } from './inspect';
export const instanceOf: (value: unknown, constructor: Constructor) => boolean =
/* c8 ignore next 6 */
// FIXME: https://github.com/graphql/graphql-js/issues/2317
globalThis.process && globalThis.process.env.NODE_ENV === 'production'
isProduction
JoviDeCroock marked this conversation as resolved.
Show resolved Hide resolved
? function instanceOf(value: unknown, constructor: Constructor): boolean {
return value instanceof constructor;
}
Expand Down